Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # getAngle
- from pymel.core import *
- def getDist(a,b):
- s1t = getPiv(a)
- s2t = getPiv(b)
- dist = math.sqrt((s2t[0] - s1t[0])**2 + (s2t[1] - s1t[1])**2 + (s2t[2] - s1t[2])**2)
- return dist
- def getAngle(a,b):
- l1 = spaceLocator()
- pc1 = pointConstraint(a,l1)
- l2 = spaceLocator()
- pc2 = pointConstraint(b,l2)
- ac = aimConstraint(l2,l1,aim = [0,1,0], u=[0,1,0])
- r1 = a.getRotation()
- r2 = l1.getRotation()
- x = r1[0]+r2[0]/2
- y = r1[1]+r2[1]/2
- z = r1[2]+r2[2]/2
- angle = x,y,z
- delete(l1,l2,pc1,pc2,ac)
- return angle
- sl = selected()
- a = getAngle(sl[0],sl[1])
- rotate(sl[0], a)
Advertisement
Add Comment
Please, Sign In to add comment