natiny.physics.apply_impulse
natiny.physics.apply_impulse(body, ix, iy, iz)
Adds a kick through the centre of mass, in world space.
Parameters
| Name | Type | Description |
|---|---|---|
body |
number |
Body handle |
ix |
number |
Impulse along X, kg*m/s |
iy |
number |
Impulse along Y, kg*m/s |
iz |
number |
Impulse along Z, kg*m/s |
Example
natiny.physics.apply_impulse(crate, 0, 0, -12)
Notes
- An impulse is a change of momentum, so the same one moves a heavy body less.
To reach a speed regardless of mass, use
natiny.physics.set_velocity. - Adds to the body's motion rather than replacing it, and wakes it.
- Through the centre of mass, so it never imparts spin.
- Only dynamic bodies are affected; static and kinematic bodies ignore it.