natiny.physics.set_interpolation
natiny.physics.set_interpolation(body, enabled)
Enables or disables visual interpolation of a body's entity transform between fixed physics ticks.
Parameters
| Name | Type | Description |
|---|---|---|
body |
number |
Body handle |
enabled |
boolean |
true to interpolate the transform; false to use the latest simulated transform |
Example
natiny.physics.set_interpolation(crate, true)
Notes
- Interpolation is disabled when a body is created.
- It blends position linearly and rotation along the shortest quaternion path. This changes only the entity transform used by rendering; it does not change the solver state or the fixed 60 Hz simulation rate.
- The interpolated transform can trail the latest simulated transform by up to one physics tick. Objects parented to the body follow that transform.
- Changing the body transform through the entity API resets its interpolation history, so teleporting it does not produce a sweep from the old transform.
- Enabling interpolation starts from the body's current transform. Passing a handle that is not a live body has no effect.