MAXScript FAQ > Working With Animation > How do I link the rotation of an object to the scene time? |
I want to create a simple expression that will rotate an object based on the current time.
You can assign a Float Script Controller to the respective rotation sub-controller and use the current Time global variable to get the time.
FOR EXAMPLE, |
if you want to rotate the object about its X axis, you should assign a Float Script controller to the .rotation.x_rotation.controller property: |
This will rotate the object, but the rotation will be very fast because the time value is taken as radians, causing a full 360 degrees rotation every 6.28 frames!
This will rotate the object 360 degrees in 360 frames. You can of course multiply the result by any factor to control the exact speed,
will rotate the object at 360 degrees in 3600 frames...
Another way to do the same is using the Float Expression controller. Unfortunately, it is not completely scriptable.
will assign a float expression controller to the X rotation track.
Now you can open the Expression window by going to the Motion tab, right-clicking the controller and selecting Properties...
and press the Evaluate button.
The result should be the same as the Flot Script controller version.