natiny.physics.set_rotation_locks
natiny.physics.set_rotation_locks(body, lock_x, lock_y, 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 |
number |
Body handle |
lock_x |
boolean |
true to prevent rotation around the world X axis (pitch) |
lock_y |
boolean |
true to prevent rotation around the world Y axis (yaw) |
lock_z |
boolean |
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)