Path()

Class for representing a walkable path.

new Path()

Constructs a new path.

Author:

Members

loop :Boolean

Whether this path is looped or not.

Methods

add(waypoint) → {Path}

Adds the given waypoint to this path.

Parameters:
Name Type Description
waypoint Vector3

The waypoint to add.

Returns:
Path -

A reference to this path.

advance() → {Path}

Makes the next waypoint of this path active. If the path is looped and Path#finished returns true, the path starts from the beginning.

Returns:
Path -

A reference to this path.

clear() → {Path}

Clears the internal state of this path.

Returns:
Path -

A reference to this path.

current() → {Vector3}

Returns the current active waypoint of this path.

Returns:
Vector3 -

The current active waypoint.

finished() → {Boolean}

Returns true if this path is not looped and the last waypoint is active.

Returns:
Boolean -

Whether this path is finished or not.

fromJSON(json) → {Path}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
Path -

A reference to this path.

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.