Hey guys I just watched a video on how to place your polevector to avoid any popping and I was wondering what steps it takes to make the script work in mel
from maya import cmds , OpenMaya
import math
sel = cmds.ls(sl = 1)
start = cmds.xform(sel[0] ,q= 1 ,ws = 1,t =1 )
mid = cmds.xform(sel[1] ,q= 1 ,ws = 1,t =1 )
end = cmds.xform(sel[2] ,q= 1 ,ws = 1,t =1 )
startV = OpenMaya.MVector(start[0] ,start[1],start[2])
midV = OpenMaya.MVector(mid[0] ,mid[1],mid[2])
endV = OpenMaya.MVector(end[0] ,end[1],end[2])
startEnd = endV - startV
startMid = midV - startV
dotP = startMid * startEnd
proj = float(dotP) / float(startEnd.length())
startEndN = startEnd.normal()
projV = startEndN * proj
arrowV = startMid - projV
arrowV*= 0.5
finalV = arrowV + midV
cross1 = startEnd ^ startMid
cross1.normalize()
cross2 = cross1 ^ arrowV
cross2.normalize()
arrowV.normalize()
matrixV = [arrowV.x , arrowV.y , arrowV.z , 0 ,
cross1.x ,cross1.y , cross1.z , 0 ,
cross2.x , cross2.y , cross2.z , 0,
0,0,0,1]
matrixM = OpenMaya.MMatrix()
OpenMaya.MScriptUtil.createMatrixFromList(matrixV , matrixM)
matrixFn = OpenMaya.MTransformationMatrix(matrixM)
rot = matrixFn.eulerRotation()
loc = cmds.spaceLocator()[0]
cmds.xform(loc , ws =1 , t= (finalV.x , finalV.y ,finalV.z))
cmds.xform ( loc , ws = 1 , rotation = ((rot.x/math.pi*180.0),
(rot.y/math.pi*180.0),
(rot.z/math.pi*180.0)))
This is from Marco Giordano
and is pretty great, however I want to try making this is Mel, but don’t know how certain command work. I might be over thinking it and this might be very simple but If you guys could give an explanation or a method to get similar results with a offset ability would be greatly appreciated
Most of what I’m confused
Is the OpenMaya stuff. It seems i can’t find it in the autodesk technical documentation, but I can find it in the API. Is there any possible way for them to be used in Mel? Thanks for your time and in advance!