PhysicsSystem:simulate_physics
Ticks the physics simulation. This involves:
- Activating or destroying love.Body and love.Fixture objects.
- Giving each Body a linear velocity matching its desired Movement.
- Updating the Box2D simulation.
- Calling
on_collide/on_uncollide/on_activate/on_deactivateon the relevant Collider and Sensor components.
Usage
physics_system:simulate_physics(delta_time)
Returns
| Name | Type | Description |
|---|---|---|
delta_time | number | Duration to simulate, in seconds. |
Examples
local MyScene = Class("MyScene", crystal.Scene);
MyScene.init = function(self)
self.ecs = crystal.ECS:new();
self.physics_system = self.ecs:add_system(crystal.PhysicsSystem);
end
MyScene.update = function(self, delta_time)
self.physics_system:simulate_physics(delta_time);
end