how to code cubes that move in increments


import maya.cmds

Animation_Range = 10

def Create_Cube(increment):

    Cube = cmds.polyCube()

    cmds.move(increment, x = True)

    

for x in range(1,101,10):   

    Create_Cube(x)

cube = cmds.polyCube()

for i in range(Animation_Range):

    cmds.currentTime( (i+1)*10, edit=True )

    cmds.setKeyframe(cube,v=i, at="translateX")

this code spawns in cubes from 1-101 in increments of 10 along the x axis it also animates one of the cubes. it also shows you how to spawn in multiple cubes.

Leave a comment

Log in with itch.io to leave a comment.