natiny_physics_set_rotation_locks
void natiny_physics_set_rotation_locks(NatinyBody body, bool lock_x, bool lock_y, bool lock_z);
Locks or unlocks rotation of a body around each world axis independently. The solver cannot turn the body around a locked axis, while the axes left free keep responding to gravity, contacts and impulses.
Parameters
| Name | Type | Description |
|---|---|---|
body |
NatinyBody |
Body handle |
lock_x |
bool |
true to prevent rotation around the world X axis (pitch) |
lock_y |
bool |
true to prevent rotation around the world Y axis (yaw) |
lock_z |
bool |
true to prevent rotation around the world Z axis (roll) |
Example
/* Stays upright, but is still free to spin around Y */
natiny_physics_set_rotation_locks(player, true, false, true);