PathFollowing

PathFollowing

Creates a behaviour that follows a certain path.

Constructor

new PathFollowing(path)

Source:
Parameters:
Name Type Description
path Path

Extends

Classes

PathFollowing

Members

active :boolean

Description:
  • Whether to exert a behaviour's calculated force onto its agent
Source:
Overrides:
Whether to exert a behaviour's calculated force onto its agent
Type:
  • boolean

loop :boolean

Description:
  • If the agent should start at the beginning after reaching the ent of the path.
Source:
If the agent should start at the beginning after reaching the ent of the path.
Type:
  • boolean

maxForce :number

Description:
  • Maximum force a behaviour will exert on the agent.This affects acceleration, deceleration and turn rate of the agent.
Source:
Overrides:
Maximum force a behaviour will exert on the agent.This affects acceleration, deceleration and turn rate of the agent.
Type:
  • number

maxSpeed :number

Description:
  • The maximum speed a behaviour will reach when active.
Source:
Overrides:
The maximum speed a behaviour will reach when active.
Type:
  • number

path :Path

Description:
  • The path taken by a pathfollowing behaviour.
Source:
The path taken by a pathfollowing behaviour.
Type:

Methods

add(point)

Description:
  • Adds a point into the path.
Source:
Parameters:
Name Type Description
point Vector2

calc(position, velocity, target, inv_dt) → {Vector2}

Source:
Parameters:
Name Type Description
position Vector2
velocity Vector2
target Vector2
inv_dt number
Returns:
the first parameter
Type
Vector2

clear()

Description:
  • Removes all points on the path.
Source:

setPath(path)

Description:
  • Sets a new path to follow.
Source:
Parameters:
Name Type Description
path Path