Movement:heading
Returns the direction this entity is attempting to move towards.
A nil heading indicates that the entity is not trying to move.
Usage
movement:heading()
Returns
| Name | Type | Description |
|---|---|---|
heading | number | Heading direction in radians. |
Examples
local ecs = crystal.ECS:new();
ecs:add_system(crystal.PhysicsSystem);
local entity = ecs:spawn(crystal.Entity);
entity:add_component(crystal.Body);
entity:add_component(crystal.Movement);
entity:set_heading(math.pi);
print(entity:heading()); -- Prints "3.1415..."