Skip to content

Instantly share code, notes, and snippets.

View frank-withyou's full-sized avatar

frank-withyou

View GitHub Profile
@frank-withyou
frank-withyou / Snap Pivot to World Origin - Maya Python Script
Last active October 8, 2025 09:29
Select objects | Open the Script Editor > Python tab | Paste the code and Execute
import maya.cmds as cmds
sel = cmds.ls(selection=True, type="transform")
for obj in sel:
# get current world position of pivot
pivot = cmds.xform(obj, q=True, ws=True, rp=True) # rotate pivot = transform origin
# calculate offset needed to move pivot to (0,0,0)
offset = [-pivot[0], -pivot[1], -pivot[2]]
# move the object by that offset
cmds.move(offset[0], offset[1], offset[2], obj, r=True, ws=True)