Transform
The transform component contains the position, rotation, and scale of the entity.
Properties:
Property | Functionality |
---|---|
position | A vec2 [x, y] for the world coordinates of the entity. |
scale | A vec2 [x, y] for the scale. Used to increase/decrease the size of an entity. |
rotation | A float value for the rotation of the entity in degrees. |
Use Example:
-- Create a new entity
local entity = Entity("tag", "group")
-- Add a new transform component at position [50, 50], scale of 1 and no rotation.
local transform = entity:add_component(Transform(vec2(50, 50), vec2(1, 1), 0.0))
-- access the transform properties
transform.position = vec2(100, 100)
transform.scale = vec2(2, 1)
transform.rotation = 45.0