Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python for Maya - Places a new object in another objects animated position at each frame
import maya.cmds as cmds
selection = cmds.ls(sl=1,sn=True)
for frame in range(1,80):
cmds.currentTime(frame)
newCube = cmds.ls (cmds.polyCube( sx=1, sy=1, sz=1), long=True)
posX = cmds.getAttr(selection[0]+'.translateX')
posY = cmds.getAttr(selection[0]+'.translateY')
posZ = cmds.getAttr(selection[0]+'.translateZ')
cmds.setAttr(newCube[0]+'.translateX',posX)
cmds.setAttr(newCube[0]+'.translateY',posY)
cmds.setAttr(newCube[0]+'.translateZ',posZ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.