Manages the properties associated with time.

// using deltaTime to increment a timer
this.timer += this.timeManager.deltaTime;

// using physicsDeltaTime within a physics component to move the object it belongs to
this.transform.position.x += speed * this.timeManager.physicsDeltaTime;

// stop all time-related interactions by setting the scale to zero
this.timeManager.timeScale = 0;

Constructors

Properties

browserDeltaTime: number = 0

The time difference, in seconds, between the last frame of and the current frame recorded by the browser.

timeScale: number = 1

The scale on which time passes. The default value is 1.
For example, if set to 2, the time will run at twice the speed.
If set to 0.5, it will run at half the speed.
If set to 0, everything associated with the time will stop.

unscaledDeltaTime: number = 0

The time difference, in seconds, between the last frame and the current frame, unaffected by the scale.

unscaledPhysicsDeltaTime: number = 0

The time difference, in seconds, between the last physics frame and the current one, unaffected by the scale.

Accessors

  • get deltaTime(): number
  • The time difference, in seconds, between the last frame and the current frame.

    Returns number

  • get physicsDeltaTime(): number
  • The time difference, in seconds, between the last physics frame and the current one.

    Returns number

  • get renderDeltaTime(): number
  • The browser delta time affected by time scale.

    Returns number