Skip to content

YaMoverComponent

Beta
YaMoverComponent determines whether an object moves and the way it moves.

Functions

void Start()Beta
Starts the object moves
void Stop()Beta
Stops the object moves
void SetSpeed(number speed)Beta
Sets the movement speed (m/s).
number GetSpeed()Beta
Gets the movement speed (m/s).
void SetTargetPosition(float3 position)Beta
Sets the target position of the movement.
float3 GetTargetPosition()Beta
Gets the target position of the movement.

Events

StartEvent<void>Beta
Triggered when the movement starts.
PauseEvent<void>Beta
Triggered when the movement pauses.
FinishEvent<void>Beta
Triggered when the movement finishes.

Code sample

This following code sample makes the object move in the specified speed to the specified position.

--Prepares the component.
local mover = script:GetYaComponent("YaMoverComponent")
--Sets the movement speed to 5 m/s.
mover:SetSpeed(5)
-- Sets the target position of the movement to (0,100,0).
mover:SetTargetPosition(float3.New(0,100,0))
-- Starts the movement.
mover:Start()