new Time()
Constructs a new time object.
Methods
-
disableFixedDelta() → {Time}
-
Disables the usage of a fixed delta value.
-
dispose() → {Time}
-
Frees all internal resources.
-
enableFixedDelta() → {Time}
-
Enables the usage of a fixed delta value. Can be useful for debugging and testing.
-
getDelta() → {Number}
-
Returns the delta time in seconds. Represents the completion time in seconds since the last simulation step.
Returns:
Number -The delta time in seconds.
-
getElapsed() → {Number}
-
Returns the elapsed time in seconds. It's the accumulated value of all previous time deltas.
Returns:
Number -The elapsed time in seconds.
-
getFixedDelta() → {Number}
-
Returns the fixed delta time in seconds.
Returns:
Number -The fixed delta time in seconds.
-
getTimescale() → {Number}
-
Returns the timescale value.
Returns:
Number -The timescale value.
-
reset() → {Time}
-
Resets this time object.
-
setFixedDelta(fixedDelta) → {Time}
-
Sets a fixed time delta value.
Parameters:
Name Type Description fixedDelta
Number Fixed time delta in seconds.
-
setTimescale(timescale) → {Time}
-
Sets a timescale value. This value represents the scale at which time passes. Can be used for slow down or accelerate the simulation.
Parameters:
Name Type Description timescale
Number The timescale value.
-
update() → {Time}
-
Updates the internal state of this time object.