The internal update method. This is called automatically by the parent Scene.
Moves the simulation forward in time by delta ms. Uses World.correction
value as an optional number that
specifies the time correction factor to apply to the update. This can help improve the accuracy of the
simulation in cases where delta is changing between updates. The value of correction is defined as delta / lastDelta
,
i.e. the percentage change of delta over the last step. Therefore the value is always 1 (no correction) when
delta is constant (or when no correction is desired, which is the default).
See the paper on Time Corrected Verlet for more information.
Triggers beforeUpdate
and afterUpdate
events. Triggers collisionStart
, collisionActive
and collisionEnd
events.
If the World is paused, update
is still run, but exits early and does not update the Matter Engine.
name | type | description |
---|---|---|
time | number |
The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout. |
delta | number |
The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate. |