Skip to content

YaPendulumComponent

YaPendulumComponent controls the circular motion of an object. YaPendulumComponent can only function when the Pendulum module (https://developer.yahaha.com/manual/yahaha-studio-manual/scripting/module/module-reference/Pendulum/) is added to the same object.

Functions

void Start()

SERVER ONLY 
Starts the object a circular motion.

void Stop()

SERVER ONLY 
Stops the object a circular motion.

number GetSpeed()

SERVER ONLY 
Gets the spin speed.

void SetSpeed(number speed)

SERVER ONLY 
Sets the spin speed.
  • speed speed(m/s)

void SetRotationAxis(float3 axis)

SERVER ONLY 
Sets the target rotation axis.
  • axis axis

float3 GetRotationAxis()

SERVER ONLY 
Gets the target rotation axis.

void SetCenterPoint(float3 point)

SERVER ONLY 
Sets the center point of the circular motion.
  • point global position

float3 GetCenterPoint()

SERVER ONLY 
Returns the center point of the circular motion.

void SetTargetAngle(number angle)

SERVER ONLY 
Sets the target angle to which the object moves.
  • angle angle of rotation

number GetTargetAngle()

SERVER ONLY 
Gets the target angle to which the object moves.

Events

StartEvent<void>

SERVER ONLY 
Triggered when the circular motion starts.

PauseEvent<void>

SERVER ONLY 
Triggered when the circular pauses.

FinishEvent<void>

SERVER ONLY 
Triggered when the circular motion finishes.

Code sample

The following code sample demonstrates how to make an object start a circular motion.

1
2
3
4
5
6
7
8
-- Prepares the component.
local pendulum = script:GetYaComponent("YaPendulumComponent")
-- Sets the center point to (0,0,1).
pendulum:SetCenterPoint(float3.New(0,0,1))
-- Sets the target angle to 1080 degrees.
pendulum:SetTargetAngle(1080)
-- Starts the circular motion.
pendulum:Start()