Physics Basic Shape: Rotate
Rotate the shape until it is at the specified orientation.
Only one rotation can be performed at a time. If this function is called before a previous rotation has completed, the first rotation will stop where it is, and the new rotation will start from that point.
Function
void Rotate(direction, tilt, roll, dirSpeed, tiltSpeed, rollSpeed);
void Rotate(direction, tilt, roll, dirSpeed, tiltSpeed, rollSpeed, dirAcc, dirDec, tiltAcc, tiltDec, rollAcc, rollDec);
void Rotate(direction, tilt, roll, dirSpeed, tiltSpeed, rollSpeed,CallbackFunction);
void Rotate(direction, tilt, roll, dirSpeed, tiltSpeed, rollSpeed,CallbackFunction, dirAcc, dirDec, tiltAcc, tiltDec, rollAcc, rollDec);
Parameters
Name | Type | Description |
---|---|---|
Direction | Number | The direction to move the shape’s Direction towards, in degrees. |
Tilt | Number | The tilt to move the shape’s Tilt towards, in degrees. |
Roll | Number | The roll to move the shape’s Roll towards, in degrees. |
dirSpeed | Number | The speed to modify the direction in, in degrees per second. |
tiltSpeed | Number | The speed to modify the tilt in, in degrees per second. |
rollSpeed | Number | The speed to modify the roll in, in degrees per second. |
CallbackFunction | function(shape, direction, tilt, roll) | This function will be called with the shape instance and the direction tilt and roll in degrees when the rotation is completed. |
dirAcc | Number | Acceleration of direction rotation in degrees/second^2. |
dirDec | Number | Deceleration of direction rotation in degrees/second^2. |
tiltAcc | Number | Acceleration of tilt rotation in degrees/second^2. |
tiltDec | Number | Deceleration of tilt rotation in degrees/second^2. |
rollAcc | Number | Acceleration of roll rotation in degrees/second^2. |
rollDec | Number | Deceleration of roll rotation in degrees/second^2. |
Example
function OnSimulationStart()
{
let shape = GetComponentByNameAndType("PhysicsBasicShape1", "Physics Basic Shape");
shape.Rotate(20, 30, 40, 5, 3, 2, OnRotateComplete);
}
function OnRotateComplete(sender, direction, tilt, roll)
{
LogDebug(`${sender.Name} = ${direction} ${tilt} ${roll}`);
}