natiny.physics.set_type

Lua
natiny.physics.set_type(body, type)

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

Parameters

Name Type Description
body number Body handle
type number BODY_DYNAMIC, BODY_STATIC or BODY_KINEMATIC

Constants

Name Description
natiny.physics.BODY_DYNAMIC Has mass, moved by forces and collisions
natiny.physics.BODY_STATIC Not moved by forces, velocity or collisions
natiny.physics.BODY_KINEMATIC Moved by the game; pushes dynamic bodies without being pushed back

Example

Lua
natiny.physics.set_type(wall, natiny.physics.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 BODY_KINEMATIC, or a box.
  • A kinematic body is driven with natiny.entity.set_position or natiny.physics.set_velocity.
  • Any other numeric type is treated as BODY_DYNAMIC.