natiny_physics_get_velocity
void natiny_physics_get_velocity(NatinyBody body, float* vx, float* vy, float* vz);
Reads a body's linear velocity in world space.
Parameters
| Name | Type | Description |
|---|---|---|
body |
NatinyBody |
Body handle |
vx |
float* |
Receives metres per second along X; may be null |
vy |
float* |
Receives metres per second along Y; may be null |
vz |
float* |
Receives metres per second along Z; may be null |
Example
float vx, vy, vz;
natiny_physics_get_velocity(player, &vx, &vy, &vz);
Notes
- A body that has gone to sleep reads as zero, because it is not moving.
- An invalid handle writes zeros rather than leaving the outputs alone.
- Rotation is not reported; this is the velocity of the centre of mass.