crystal.PhysicsSystem
This ECS System manages a love.World. It also powers Body, Movement, Collider and Sensor components.
When using the ShowPhysicsOverlay command and sending this system a draw_debug notification, it draws colored shapes representing all Collider and Sensor components. The colors are determined by the categories of the corresponding component.
Methods
| Name | Description |
|---|---|
| simulate_physics | Ticks the physics simulation. |
| world | Returns the love.World managed by this system. |
Console Commands
| Name | Description |
|---|---|
HidePhysicsOverlay | Stops drawing the shape of all colliders and sensors. |
ShowPhysicsOverlay | Starts drawing the shape of all colliders and sensors. |
Examples
local ecs = crystal.ECS:new();
local physics_system = ecs:add_system(crystal.PhysicsSystem);
physics_system:world():setGravity(0, 10);