Transform - Wantcha/Chimera GitHub Wiki

Transform Component

TransformComponent is a variable type working with both information about the transform of the entity and utility functions regarding it. It can be retrieved from an entity using the GetTransformComponent() function.

- TransformComponent.position

Position of the entity in world space.

- TransformComponent.rotation

Rotation of the entity in world space.

- TransformComponent.scale

Scale of the entity in world space.

- TransformComponent.localPosition

Position of the entity relative to its parent.

- TransformComponent.localRotation

Rotation of the entity relative to its parent.

- TransformComponent.localScale

Scale of the entity relative to its parent.

- Vector3 TransformComponent:GetForward()

Returns a Vector3 containing the forward vector of the entity (the direction it is facing).

- Entity TransformComponent:GetParent()

Returns the parent Entity of the current Entity. If the current Entity has no parent, the returned value will be nil.

- void TransformComponent:SetParent(Entity newParent)

Sets newParent to be the new parent of the current Entity.

- Matrix4 TransformComponent:GetTransform()

Returns the world transform matrix of the Entity.

- Matrix4 TransformComponent:GetLocalTransform()

Returns the local transform matrix of the Entity.