natiny_physics_set_velocity

C
void natiny_physics_set_velocity(NatinyBody body, float vx, float vy, float vz);

Sets a body's linear velocity in world space and wakes it.

Parameters

Name Type Description
body NatinyBody Body handle
vx float Metres per second along X
vy float Metres per second along Y
vz float Metres per second along Z

Example

C
natiny_physics_set_velocity(player, 0.0f, 5.0f, 0.0f);   /* jump */

Notes

  • This replaces whatever the body was doing, which is what a jump or a conveyor wants and what a push does not - for a push, use natiny_physics_apply_impulse.
  • Wakes the body, so it is felt on the next step even if it had gone to sleep.
  • The way to drive a kinematic body that should carry others along with it.
  • Static bodies ignore velocity changes.