The Smooth Rotate entity lets you add basic animation or movement to a Node in a 3D Document. The Smooth Rotate entity can be used to rotate a Node to a new target rotation with a specified speed. Smooth Rotate is great for rotating Nodes in a continuous way or for rotating Nodes multiple times with interruption.
You can constantly change the target rotation and the entity will continue to attempt to get to the target rotation. Unlike Animate Rotation this entity handles interruptions easily and lets you change the angles during rotation. This makes the entity ideal for rotating models around a scene. For example, you can use this entity to position or lay out models in a scene.
The example above uses Smooth Rotate to rotate the sphere round in a square. The Smooth Rotate entity rotates between 3 angles and changes to the next angle once it has reached its target. These are 120, 240 and 0. This results in the sphere going round in a full circle.
With the model Node selected and the Smooth Rotate entity added to the Node, the following will be displayed in the Information Panel:
Smooth Rotate Enabled
Enable and disable the Smooth Rotate entity. Disabling the entity will stop the entity where it is and the Node will stay in its current rotation.
Target
Target is the new rotation or target for the Node to rotate towards. Target can be specified in two ways. You can target another Node in a DriveWorks 3D Document or you can enter the rotation as a pipe delimited list (X|Y|Z).
Root\Model\Model-1
0|120|90 - X|Y|Z
Use World Rotation
Use World Rotation changes the behavior when targeting a rotation. When targeting a rotation (X|Y|Z) this property determines if that rotation is relative to the current Node or to the world space.
Nodes can be parented together and offset from each other in any axis. This changes their overall world rotation. For example, if you have 4 Nodes parented and offset from each other by 10 degrees in the Y axis, the fourth Node will have a world rotation of 40 degrees in the Y axis.
This property lets you set the rotation of a Node relative to its local or world rotation, giving you freedom to choose.
Speed
Speed controls the speed of the Smooth Rotate entity. The higher the number the faster the rotation of the Node.
Smooth
Smooth controls whether or not the Node slows down as it nears the target rotation. If you check Smooth then the Node will decelerate as it goes towards the target.
On Complete Macro Name
On Complete Macro Name is used to specify a Specification Macro Name. This runs a Specification Macro at the end of the rotation letting you trigger other events or further rotation.
On Complete Macro Argument
On Complete Macro Argument is used to specify an argument for the Specification Macro that is run above. This argument is passed into the Specification Macro like any other Specification Macro in DriveWorks.
With the model Node selected and the Smooth Rotate entity added to the Node, the following will be displayed in the Parameter Panel:
Smooth Rotate Enabled controls the enabled state of the Smooth Rotate entity. Enter either TRUE or FALSE to control the enabled state of the entity.
Target is the new rotation or target for the Node to rotate towards. Target can be specified as a Node path or as a 3D rotation (X|Y|Z).
Use World Rotation determines whether to rotate the model against the Nodes local rotation or against the world rotation. Enter either TRUE or FALSE.
Speed controls the speed of the Smooth Rotate entity. Enter a number.
Smooth controls whether or not the Node slows down as it nears the target rotation. Enter either TRUE or FALSE.
On Complete Macro Name is the name of the Specification Macro to run once the animation completes. Enter the Specification Macro name as a string.
On Complete Macro Argument is used to pass an argument into the Specification Macro Name above.
Smooth Rotate can be used for basic animations and movement of Nodes. For example, you can create an exploded view in 3D, move or rotate a model in a 3D scene, or open drawers in furniture. Smooth Rotate provides a precise linear rotation of the Node, this can only be changed slightly by selecting the Smooth property on the entity. This will cause the entity to decelerate in speed as it approaches a target rotation.
Position or lay out models
The Smooth Rotate entity can be combined with the Smooth Translate entity to position or lay out models in a 3D scene. In the example below, the filing cabinet has two entities applied to it, Smooth Rotate and Smooth Translate. When you select a wall, the model will smoothly move and rotate to the selected location.
This results in a really nice experience as the model moves and rotates smoothly to the selected location. This makes use of these entities but also uses the Vector functions to work out the angles of rotation and the position in 3D space.