Basicshape: StopMovement
This cancels the effect of any GoToPosition command and leaves the object in the current position.
Function
void StopMovement();
Parameters
None
Return Value
None
Example
var _basicShape1;
var goingUp = true;
function OnSimulationStart()
{
InitAnimation();
StartAnimation();
}
function InitAnimation()
{
//-- get basic shape1:
_basicShape1 = GetComponentByNameAndType("BasicShape1", "Basic Shape");
//-- subscribe to event 'OnArrivePosition'
SubscribeToEvent("OnArrivePosition", "BasicShape1", "Basic Shape", "OnArrivePosition_callback");
}
function StartAnimation()
{
goingUp = true;
Move();
}
function StopAnimation()
{
_basicShape1.StopMovement();
}
function OnArrivePosition_callback()
{
LogDebug("OnArrivePosition_callback called")
goingUp = !goingUp;
Move();
}
function Move()
{
if(goingUp)
_basicShape1.GoToPosition(0, 0, 0, 0, 0, 0.9); // ask to go down (on Z axis)
else
_basicShape1.GoToPosition(0, 0, 3, 0, 0, 0.9); // ask to go up (on Z axis)
}