Skip to content

Instantly share code, notes, and snippets.

@nobolu-ootsuka-unrealengine
Created September 15, 2019 10:07
Show Gist options
  • Save nobolu-ootsuka-unrealengine/e9a9a616eb14273167c7cdb1f1d746e1 to your computer and use it in GitHub Desktop.
Save nobolu-ootsuka-unrealengine/e9a9a616eb14273167c7cdb1f1d746e1 to your computer and use it in GitHub Desktop.
jointTojointLong.py
from maya import cmds ,OpenMaya
# ジョイントのローカルXの差が出したいから
start = cmds.xform("joint1" , q=1 , ws = 0 , translation =1)
end = cmds.xform("joint2" , q=1 , ws = 0 , translation =1)
print("start[0]="+str(start[0]))
print("end[0]="+str(end[0]))
long=end[0]-start[0]
long=abs(long)
long=long*1
print("long="+str(long))
# ジョイントの長さにそわせたいから長さ、Cubeと書く
cmds.xform("Cube" , ws=1 ,scale=(long,1,1))
#cmds.scaleConstraint( 'cone1', 'cube1' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment