Last active
June 19, 2018 09:00
-
-
Save tpoveda/fba8c32e23cd2044bab5137e7a7653a9 to your computer and use it in GitHub Desktop.
Snap source object pivot position to the world position of the target object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
def snap_pivot(source=None, target=None): | |
sel = cmds.ls(sl=True) | |
source = sel[0] if not source else source | |
target = sel[1] if not target else target | |
pivot = cmds.xform(target, query=True, pivots=True, worldSpace=True) | |
cmds.xform(source, worldSpace=True, pivots=(pivot[0], pivot[1], pivot[2])) | |
snap_pivot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment