natiny_physics_set_type

C
void natiny_physics_set_type(NatinyBody body, uint32_t type);

Changes what the solver is allowed to do with a body.

Parameters

Name Type Description
body NatinyBody Body handle
type uint32_t NATINY_BODY_DYNAMIC, NATINY_BODY_STATIC or NATINY_BODY_KINEMATIC

Constants

Name Description
NATINY_BODY_DYNAMIC Has mass, moved by forces and collisions
NATINY_BODY_STATIC Not moved by forces, velocity or collisions
NATINY_BODY_KINEMATIC Moved by the game; pushes dynamic bodies without being pushed back

Example

C
natiny_physics_set_type(wall, NATINY_BODY_STATIC);

Notes

  • cube and sphere start dynamic, plane and mesh static.
  • A mesh collider on a non-static body has no mass and will not behave as one; a moving obstacle wants NATINY_BODY_KINEMATIC, or a box.
  • A kinematic body is driven with natiny_entity_set_position or natiny_physics_set_velocity.
  • Any other type value is treated as NATINY_BODY_DYNAMIC.