Body:apply_impulse
Applies a linear impulse to the underlying love.Body.
The body’s position will not be affected until the next step of the physics simulation, usually ran via PhysicsSystem.
Usage
body:apply_impulse(x, y)
Arguments
| Name | Type | Description |
|---|---|---|
x | number | The x component of the impulse. |
y | number | The y component of the impulse. |
Examples
local ecs = crystal.ECS:new();
ecs:add_system(crystal.PhysicsSystem);
local entity = ecs:spawn(crystal.Entity);
entity:add_component(crystal.Body);
entity:apply_impulse(100, -50);