Interpolation: physics ticks, frames and delay
What is interpolated, where alpha comes from and why smooth rendering trails physics slightly.
Two independent clocks
Physics updates state at a fixed tick; rendering draws when a frame is ready. VSync, FPS limits and changing load do not guarantee coincident events. Tying physics to FPS changes game behavior and tick cost; simply locking FPS does not make the clocks identical either.
The interpolator retains previous and current poses. Engine.GetPhysicsInterpolationFraction supplies the between-tick fraction used for intermediate rendering. For one coordinate, the idea is render = previous + (current - previous) × alpha. This is an explanatory formula; interpolate position and orientation appropriately rather than linearly blending every matrix coefficient.
| previous | current | alpha | render |
|---|---|---|---|
| 120 | 132 | 0 | 120 |
| 120 | 132 | 0.25 | 123 |
| 120 | 132 | 0.5 | 126 |
| 120 | 132 | 0.75 | 129 |
On the next tick, current becomes previous and a new current pose arrives. Ordinary Position/GlobalTransform remains entity state, not a promise of an intermediate screen coordinate. A 3D visual consumer can use GetGlobalTransformInterpolated; Entity2D has no same-named method in the SDK.
The cost of smoothing
Using two known states introduces visual delay on the order of a physics tick. At 60 ticks/s a tick is about 16.7 ms; that is not a measurement of total input, display or network latency. Camera/input handling also affects the result.
Extrapolation predicts an unknown future, so collisions and abrupt velocity changes can invalidate it. That is a separate algorithm; PhysicsInterpolationMode does not enable arbitrary prediction. Visual interpolation does not alter physical trajectories or collision-check frequency.
Verify by observation
In the 2D example, the blue and white squares receive the same X coordinate each tick. Blue uses On, white Off. At 10 ticks/s with more frequent rendering, blue takes intermediate screen positions while white holds each physics position until the next tick. A still image shows placement; observe motion to judge smoothness.
The automated check reads colored-object centres from 72 consecutive frames of each 2D/3D example and compares screen-position changes. It also matches the 3D projection of GetGlobalTransformInterpolated against pixels. This verifies a specific example on the installed renderer, not all performance or device latency.