RotateTo (script event)
Game class
This event operates on an instance of the game class type {{{gameclass}}}
Description
Causes an entity to perform a rotation along a specified vector.
Usage
void rotateTo( vector rotateAxis )
Parameters
- [rotateAxis] - The axis around which the entity will rotate.
Examples
$my_entity.rotateTo( '0 0 90' );
Notes
This script event does not return any values. This event differs from rotateOnce in that this rotates an entity to a specific degree on the axis as opposed to adding to the current degree. The above example will cause the entity to rotate to 90 degrees on the z-axis from the entity’s 0 angle for the duration that entity’s time is set to. If no time is set, the default is 1 second.
An example of using .time, accelTime , decelTime , and rotateOnce in a short script:
void rotateCube ()
{
$cube.time (5);
$cube.accelTime (1);
$cube.decelTime (2);
$cube.rotateTo ('0 0 180');
}
This script function will cause an entity named “cube” to rotate to 180 degrees on the Z-axis, within a time period of 5 seconds. The entity will take 1 second to accelerate to its top speed, it will rotate for 2 seconds at its top speed and finally it will spend 2 seconds to decelerate from its top speed to the stopped position.