Automatic Rotation - Part 2
In this tutorial we will demonstrate how the ease of use of the rotation setup can be dramatically improved using User Data. First, load the scene you saved in Part 1 of the Automatic Rotation tutorial.
Adding User Data
Select the XPresso tag and add User Data by selecting Add User Data … from the
The Manage User Data window will automatically open. Rename the default Data element "Speed", set the Data Type to Float and Unit to Degree. This should suffice for the start. We can add more useful parameters later. Close the Manage User Data window by clicking on the OK button.
Expanding the Expression
Double-click on the XPresso tag to open the XPresso Editor.
Now drag the XPresso tag itself from the Object Manager into the XPresso Editor. This will create a new Object Node that is linked to the XPresso tag. Click on the XPresso Node’s red corner and select the User Data Speed. After doing so, delete the Constant node and the Rotation node by selecting both and pressing the Backspace key on your keyboard. Next, connect the available Math Node’s input Port to the Speed output Port.
Finally, close the XPresso Editor window and define a Speed value - any value - in the XPresso tab’s User Data. Now we no longer have to convert the radian value ourselves. This is now done automatically by Cinema 4D because the units required to do so are defined in the User Data settings.
If we play the animation now the object will rotate with a constant velocity. If you entered 90° the fan blades will rotate with a velocity of 90° per second around the Y axis, i.e., one rotation every four seconds.