natiny_physics_init
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
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 return1. - Until initialization succeeds, mutation calls do nothing,
natiny_physics_raycastreturnsfalse, velocity reads return zeroes, and body constructors return0. - Units are metres, kilograms and seconds. Gravity starts at
9.81fm/s downwards along-Y; change it withnatiny_physics_set_gravity. - The world advances in fixed 1/60 s ticks. At most
0.25fs of elapsed time is accumulated per frame. - Physics steps before the frame callback.