Skip to content

YaMovableComponent

YaMovableComponent manages an entity's Transform, including rotation, position, and scale, etc.

Functions

void SetRotationEuler(float3 rotation)

SERVER ONLY 
Sets the entity's rotation as Euler angles in degrees.
  • rotation The rotation of the entity

void SetRotationQuaternion(quaternion rotation)

SERVER ONLY 
Sets the entity's rotation as a quaternion.
  • rotation The rotation of the entity

float3 GetRotationEuler()

ReturnsThe rotation of the entity
Gets the entity's rotation as Euler angles in degrees.

quaternion GetRotationQuaternion()

ReturnsThe rotation of the entity
Gets the entity's rotation as a quaternion.

float3 GetGlobalRotationEuler()

ReturnsThe rotation of the entity
Gets the entity's rotation in world space as Euler angles in degrees. The rotation value is calculated based on the previous frame.

quaternion GetGlobalRotationQuaternion()

ReturnsThe rotation of the entity
Gets the entity's rotation in world space as a quaternion. The value is calculated based on the previous frame.

void SetGlobalRotationEuler(float3 rotation)

SERVER ONLY 
Sets the entity's rotation in world space as Euler angles in degrees .
  • rotation The rotation of the entity

void SetGlobalRotationQuaternion(quaternion rotation)

SERVER ONLY 
Sets the entity's rotation in world space as a quaternion.
  • rotation The rotation of the entity

void SetPosition(float3 position)

SERVER ONLY 
Sets the entity's position.
  • position The position of the entity

float3 GetPosition()

ReturnsThe position of the entity
Gets the entity's position in local space.

float3 GetGlobalPosition()

ReturnsThe position of the entity
Gets the entity's position in world space. The position value is calculated based on the previous frame.

void SetGlobalPosition(float3 position)

SERVER ONLY 
Sets the entity's position in world space.
  • position The position of the entity

float3 GetScale()

ReturnsThe scale of the entity
Gets the entity's scale.

float3 GetLossyGlobalScale()

ReturnsThe scale of the entity
Gets the entity's scale in world space. Note that this scale may be inaccurate because of the shearing transform. The scale value is calculated based on the previous frame.

Code sample

1
2
3
4
5
6
7
8
--Gets a movable component.
local cmp = script:GetYaComponent("YaMovableComponent")
--Sets the position of the movable component.
local f3 = float3.New(0,0,0)
cmp:SetPosition(f3)
--Gets the position of the movable component.
f3 = cmp:GetPosition()
print(f3)