Basicshape: Rotate
This function rotates the basic shape to the specified direction, tilt and roll coordinate, the specified direction, tilt and roll speeds,callbackfunction is called,direction, tilt and roll Ac is the acceleration of specific rotation and direction, tilt and roll Dec is the deceleration of specific rotation
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 of the target position |
Tilt | Number | The tilt of the target position |
Roll | Number | The roll of the target position |
dirSpeed | Number | The speed of direction rotation |
tiltSpeed | Number | The speed of tilt rotations |
rollSpeed | Number | The speed of roll rotation |
CallbackFunction | Function | Callback function will be called |
dirAcc | Number | Acceleration of direction rotation |
dirDec | Number | Deceleration of direction rotation |
tiltAcc | Number | Acceleration of tilt rotation |
tiltDec | Number | Deceleration of tilt rotation |
rollAcc | Number | Acceleration of roll rotation |
rollDec | Number | Deceleration of roll rotation |
Return Value
None
Example
function OnSimulationStart()
{
InitAnimation();
StartAnimation();
}
function InitAnimation()
{
//-- get basic shapes
_basicShape1 = GetComponentByNameAndType("BasicShape1", "Basic Shape");
_basicShape1.X = 0.0
_basicShape1.Y = 0.0
_basicShape2 = GetComponentByNameAndType("BasicShape2", "Basic Shape");
_basicShape2.X = 2.0
_basicShape2.Y = 0.0
_basicShape3 = GetComponentByNameAndType("BasicShape3", "Basic Shape");
_basicShape3.X = 4.0
_basicShape3.Y = 0.0
_basicShape4 = GetComponentByNameAndType("BasicShape4", "Basic Shape");
_basicShape4.X = 6.0
_basicShape4.Y = 0.0
_basicShape5 = GetComponentByNameAndType("BasicShape5", "Basic Shape");
_basicShape5.X = 8.0
_basicShape5.Y = 0.0
_basicShape6 = GetComponentByNameAndType("BasicShape6", "Basic Shape");
_basicShape6.X = 10.0
_basicShape6.Y = 0.0
_basicShape7 = GetComponentByNameAndType("BasicShape7", "Basic Shape");
_basicShape7.X = 12.0
_basicShape7.Y = 0.0
_basicShape8 = GetComponentByNameAndType("BasicShape8", "Basic Shape");
_basicShape8.X = 14.0
_basicShape8.Y = 0.0
}
function StartAnimation()
{
SubscribeToEvent("OnArrivePosition", _basicShape7.Name, "Basic Shape", "OnArrivePosition_callbackFromEvent");
Move();
}
function OnArrivePosition_callback( sender, x, y, z)
{
LogDebug("-> OnArrivePosition_callback " + sender.Name + " Arrived x=" + x + " y=" + y + " z=" + z)
}
function OnArrivePosition_callbackFormEvent( sender, x, y, z)
{
LogDebug("-> OnArrivePosition_callbackFormEvent " + sender.Name + " Arrived x=" + x + " y=" + y + " z=" + z)
}
function Move()
{
//-- Default
_basicShape1.GoToPosition(0, 0, 5, 0, 0, 1);
//-- Default with Acceleration deceleration
_basicShape2.GoToPosition(2, 0, 5, 0, 0, 1, 0, 0, 0, 0, 0.5, 0.5);
//-- With callback
_basicShape3.GoToPosition(4, 0, 5, 0, 0, 1, OnArrivePosition_callback);
//-- With callback and Acceleration deceleration
_basicShape4.GoToPosition(6, 0, 5, 0, 0, 1, OnArrivePosition_callback, 0, 0, 0, 0, 0.5, 0.5);
//-- with callback, interval
_basicShape5.GoToPosition(8, 0, 5, 0, 0, 1, OnArrivePosition_callback, 500);
//-- With callback ,interval and Acceleration deceleration
_basicShape6.GoToPosition(10, 0, 5, 0, 0, 1, OnArrivePosition_callback, 500, 0, 0, 0, 0, 0.5, 0.5);
//-- With callback, offset
_basicShape7.GoToPosition(12, 0, 5, 0, 0, 1, OnArrivePosition_callback, [3000,2000,1000,500]);
//-- With callback, offset and acceleration deceleration
_basicShape8.GoToPosition(14, 0, 5, 0, 0, 1, OnArrivePosition_callback, [3000,2000,1000,500], 0, 0, 0, 0, 0.5, 0.5);
}