Skip to content

Instantly share code, notes, and snippets.

@CGLion
Last active October 4, 2020 13:50
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 CGLion/f80c3686becc3f11ace1f34d83070af2 to your computer and use it in GitHub Desktop.
Save CGLion/f80c3686becc3f11ace1f34d83070af2 to your computer and use it in GitHub Desktop.
Python for Maya - Get object world space transform matrix
from maya.api.OpenMaya import MVector, MMatrix, MPoint
import maya.cmds as cmds
def get_world_transform (obj):
return MMatrix ( cmds.xform( obj, q=True, matrix=True, ws=True ) )
selected_object = (cmds.ls(sl=1,sn=True))[0]
print ( get_world_transform( selected_object ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment