Home Technical Talk

Maxscript: Iteratively Change Object Position While Adding Keyframe for Each Change

I'm in a bit of a pickle here and it's getting to me. No matter how I try I simply cannot find a way to create a keyframe for each positional change utilising iterative functions such as FOR-DO loops or WHILE-DO loops. I want to change the objects position and create a keyframe and repeat the process from the value of i=1 to i=10. How can I do this?

Here's the code I've written although frankly I don't think it will make a difference since it's so short:
for i=1 to 10 do(
	move $Small [i,0,0]
	addNewKey $Small[3] i)

I would be glad if someone could help.

Replies

  • monster
    Offline / Send Message
    monster polycounter
    Basically your script doesn't work because animate mode (Auto Key) is not enabled. For example, if you take an animated object and move it up while Auto Key is off it displaces all the key values. But if Auto Key is turned on it only affects the current frame.

    Your script is moving the object, adding a key , moving again (thereby affecting all keys)... and so on.
    for i=1 to 10 do
    (
    	at time i with animate on
    	(
    		move $Small [i,0,0]
    	)	
    )
    

    I feel like I didn't explain that well, but you can see the working code above.
Sign In or Register to comment.