natiny.physics.get_velocity
Lua
natiny.physics.get_velocity(body) -> vx, vy, vz
Reads a body's linear velocity in world space.
Parameters
| Name |
Type |
Description |
body |
number |
Body handle |
Returns
| Type |
Description |
number, number, number |
Metres per second along X, Y and Z |
Example
Lua
local vx, vy, vz = natiny.physics.get_velocity(player)
Notes
- A body that has gone to sleep reads as zero, because it is not moving.
- A non-live body handle also returns three zeroes.
- Rotation is not reported; this is the velocity of the centre of mass.