new Path()
Constructs a new path.
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.
-
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.
-
clear() → {Path}
-
Clears the internal state of this path.
-
current() → {Vector3}
-
Returns the current active waypoint of this path.
-
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.
-
toJSON() → {Object}
-
Transforms this instance into a JSON object.
Returns:
Object -The JSON object.