Skip to content

Instantly share code, notes, and snippets.

@robomojo
Created March 11, 2015 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robomojo/6546a567f99e430c0168 to your computer and use it in GitHub Desktop.
Save robomojo/6546a567f99e430c0168 to your computer and use it in GitHub Desktop.
import pymel.core as pm
def GetDistanceBetweenVectors (objA, objB):
'''
returns a float.
Expects the name of two objects.
Uses Pymel to get translation - probably a better way to do this.
'''
Ax, Ay, Az = pm.PyNode(objA).getTranslation(space="world")
Bx, By, Bz = pm.PyNode(objB).getTranslation(space="world")
return (  (Ax-Bx)**2 + (Ay-By)**2 + (Az-Bz)**2  )**0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment