natiny_physics_init

C
int natiny_physics_init(void);

Creates the rigid-body world and starts stepping it once per frame.

Returns

Type Description
int 1 when the world was created, otherwise 0

Example

C
int ok = natiny_physics_init();

Notes

  • Call this after natiny_backend_init, because backend initialization resets all engine state, including the physics world. Repeated calls do nothing and return 1.
  • Until initialization succeeds, mutation calls do nothing, natiny_physics_raycast returns false, velocity reads return zeroes, and body constructors return 0.
  • Units are metres, kilograms and seconds. Gravity starts at 9.81f m/s downwards along -Y; change it with natiny_physics_set_gravity.
  • The world advances in fixed 1/60 s ticks. At most 0.25f s of elapsed time is accumulated per frame.
  • Physics steps before the frame callback.