Last active
October 4, 2020 13:51
-
-
Save CGLion/944b1d0926b79cb32de3ac6ebbbd5d07 to your computer and use it in GitHub Desktop.
Python for Maya - Places a new object in another objects animated position at each frame
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 | |
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