Skip to content

Instantly share code, notes, and snippets.

@EricTRocks
Last active August 20, 2016 15:38
Show Gist options
  • Save EricTRocks/59c291e8df46536c1406f9054d7705cb to your computer and use it in GitHub Desktop.
Save EricTRocks/59c291e8df46536c1406f9054d7705cb to your computer and use it in GitHub Desktop.
Maya Match Translation
import maya.cmds as cmds
import pymel.core as pm
def matchTranslation():
# get selection
sel = pm.ls(selection=True)
if len(sel) < 2:
pm.error( 'Please select two objects' )
else:
srcObj = sel[0]
targets = sel[1:]
srcTr = pm.xform(srcObj, query=True, translation=True, worldSpace=True)
for tgt in targets:
pm.xform(tgt, worldSpace=True, translation=srcTr)
matchTranslation()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment