natiny_physics_set_fixed_rotation
void natiny_physics_set_fixed_rotation(NatinyBody body, bool enabled);
Locks or unlocks rotation of a body around all three axes at once. A locked body keeps the orientation it has and cannot be turned by gravity, contacts or impulses.
Parameters
| Name | Type | Description |
|---|---|---|
body |
NatinyBody |
Body handle |
enabled |
bool |
true to lock all three rotation axes; false to release them |
Example
NatinyBody player = natiny_physics_cylinder(0.4f, 1.8f);
natiny_physics_set_fixed_rotation(player, true);
Notes
- Rotation is free when a body is created.
- Locking clears the angular velocity around every locked axis, so a body that was already toppling stops where it stands rather than keeping the tilt.
- The body can still be turned by hand through
natiny_entity_set_rotation, which is how an upright character aims. - This is
natiny_physics_set_rotation_lockswith the same value on all three axes; either call overwrites what the other set. - Linear motion is unaffected.
- Passing a handle that is not a live body has no effect.