Posted December 15, 2022 by ibs03
The code below animates a cube moving along the x axis every by using a for loop to increment every 10 in range, when the code is running the cube will move forward
import maya.cmds
Animation_Range = 10
def Create_Cube(increment):
Cube = cmds.polyCube()
cmds.move(increment, x = True)
for i in range(1,101,10):
Create_Cube(i)
cube = cmds.polyCube()
for i in range(Animation_Range):
cmds.currentTime( (i+1)*10, edit=True )
cmds.setKeyframe(cube,v=i, at="translateX")