RotateOnce (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 once.
Usage
void rotateOnce( vector rotateAxis )
Parameters
- [rotateAxis] - The axis around which the entity will rotate.
Examples
$my_entity.rotateOnce( '0 0 90' );
Notes
This script event does not return any values. This event differs from rotate in that this is a terminating script event while rotate will force an entity to rotate for the duration of the game. The above example will cause the entity to rotate 90 degrees on the z-axis 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.rotateOnce ('0 0 180');
}
This script function will cause an entity named “cube” to rotate 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.