Class: SnapshotManager

Grape2D. SnapshotManager

new SnapshotManager(clock, history, lerp)

Snapshot manager.
Parameters:
Name Type Description
clock Grape2D.utils.Clock A clock.
history Grape2D.SnapshotHistory Snapshot buffer.
lerp number Interpolation time, in millisecond.
Source:

Members

<private> clock :Grape2D.utils.Clock

Game clock.
Type:
Source:

<private> currentSnapshot :Grape2D.Snapshot

Current snapshot, being used.
Type:
Source:

<private> history :Grape2D.SnapshotHistory

Snapshot history.
Type:
Source:

<private> iLerp :number

Inverse of the interpolation time.
Type:
  • number
Source:

<private> lerp :number

Interpolation time between state and snapshot.
Type:
  • number
Source:

<private> lerpPercent :number

Interpolation percent, of the cycle.
Type:
  • number
Source:

Methods

getLerpPercent() → {number}

Gets the interpolation percentage.
Source:
Returns:
Number between 0 and 1.
Type
number

getSnapshot() → {Grape2D.Snapshot}

Gets the current snapshot.
Source:
Returns:
Snapshot object.
Type
Grape2D.Snapshot

getSnapshotNetworkObject2D(id) → {Grape2D.SnapshotNetworkObject2D}

Gets a snapshot object by it's id.
Parameters:
Name Type Description
id number | string Object's id.
Source:
Returns:
Object.
Type
Grape2D.SnapshotNetworkObject2D

update()

Method to set up the cycle.
Source: