natiny_physics_apply_impulse
void natiny_physics_apply_impulse(NatinyBody body, float ix, float iy, float iz);
Adds a kick through the centre of mass, in world space.
Parameters
| Name | Type | Description |
|---|---|---|
body |
NatinyBody |
Body handle |
ix |
float |
Impulse along X, kg*m/s |
iy |
float |
Impulse along Y, kg*m/s |
iz |
float |
Impulse along Z, kg*m/s |
Example
natiny_physics_apply_impulse(crate, 0.0f, 0.0f, -12.0f);
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.