natiny.physics.init
natiny.physics.init() -> ok
Creates the rigid-body world and starts stepping it once per frame.
Returns
| Type | Description |
|---|---|
boolean |
true when the world was created, otherwise false |
Example
local 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 returntrue. - Until initialization succeeds, mutation calls do nothing,
raycastreturnsnil,get_velocityreturns zeroes, and body constructors raise an error. - Units are metres, kilograms and seconds. Gravity starts at
9.81m/s downwards along-Y; change it withnatiny.physics.set_gravity. - The world advances in fixed 1/60 s ticks. At most 0.25 s of elapsed time is accumulated per frame.
- Physics steps before the frame callback.