class
SceneTime
Manages simulation time for a particular scene.
This time runs only while scene is simulating.
Public
Constructors
SceneTime
Methods
~SceneTime
GetTimeInSeconds
Gets the time since the simulation started playing, multiplied by the time scale factor.
In editor this will reset to zero every time you start playing in editor, and in a standalone application this will be similar to GetRealTimeInSeconds(), except simulation time can be sped up/down, or stopped entirely by setting the time scale.
Returns: Time since game start, affected by simulation time scale.
SetScale
Allows you to speed time up or down, or completely pause it by providing zero.
Must be zero or larger.
GetScale
Returns the currently applied simulation time scale.
Reset
Resets the simulation time to zero.
Primarily used for editor purposes for resetting the time when ending play in editor.
SetPaused
Pauses or unpauses the simulation time.
This is equivalent to setting the time scale to 0.
SetFixedDeltaTimeUs
Sets a fixed delta time for deterministic simulation.
When enabled, the base frame delta uses this constant value before time scale is applied.
- delta
- Fixed time step in microseconds. 0 disables.
GetFixedFrameDelta
Returns the step (in seconds) between fixed frame updates.
GetLastFixedUpdateTime
Returns the time (in seconds) the latest fixed update has started.
Internal
Methods
GetFixedUpdateStep
Calculates the number of fixed update iterations required and their step size.
Values depend on the current time and previous calls to AdvanceFixedUpdateInternal().;
- outStep
- Duration of the fixed step in microseconds. In most cases this is the same duration as the fixed time delta, but in the cases where frame is taking a very long time the step might be increased to avoid a large number of fixed updates per frame.
Returns: Returns the number of fixed frame updates to execute (each of duration). In most cases this will be either 1 or 0, or a larger amount of frames are taking a long time to execute (longer than a multiple of fixed frame step).
AdvanceFixedUpdate
Advances the fixed update timers by microseconds.
Should be called once for each iteration as returned by GetFixedUpdateStepInternal(), per frame.
Private
Fields
mFrameDelta
Frame delta in seconds
mFirstFrame
mTimeInSeconds
mTimeScale
mIsTimePaused
mFixedStep
mLastFixedUpdateTime
mFirstFixedFrame
mRemainingFixedUpdateCount
mFixedDeltaTimeMicrosec
Fixed delta time in microseconds (0 = disabled, use real-time)