Body:rotation
Returns this entity’s rotation. A rotation of 0 indicates an entity facing right. Positive values indicate clockwise rotation.
Usage
body:rotation()
Returns
| Name | Type | Description |
|---|---|---|
rotation | number | Rotation in radians. |
Examples
local ecs = crystal.ECS:new();
ecs:add_system(crystal.PhysicsSystem);
local hero = ecs:spawn(crystal.Entity);
hero:add_component(crystal.Body);
hero:set_rotation(math.pi);
print(hero:rotation()); -- Prints "3.1415..."