Steering: {
alignment(velocity: Vec2, neighborVelocities: Vec2[]): Vec2;
arrive(
position: Vec2,
target: Vec2,
velocity: Vec2,
maxSpeed: number,
slowRadius?: number,
): Vec2;
cohesion(
position: Vec2,
neighbors: Vec2[],
velocity: Vec2,
maxSpeed: number,
): Vec2;
evade(
position: Vec2,
target: Vec2,
targetVelocity: Vec2,
velocity: Vec2,
maxSpeed: number,
): Vec2;
flee(position: Vec2, target: Vec2, velocity: Vec2, maxSpeed: number): Vec2;
obstacleAvoidance(
position: Vec2,
velocity: Vec2,
obstacles: { radius: number; x: number; y: number }[],
detectionRange?: number,
): Vec2;
pursue(
position: Vec2,
target: Vec2,
targetVelocity: Vec2,
velocity: Vec2,
maxSpeed: number,
): Vec2;
seek(position: Vec2, target: Vec2, velocity: Vec2, maxSpeed: number): Vec2;
separation(
position: Vec2,
neighbors: Vec2[],
desiredSeparation?: number,
): Vec2;
wander(
velocity: Vec2,
wanderDistance?: number,
wanderRadius?: number,
wanderAngle?: number,
): { angle: number; force: Vec2 };
} = ...
Type Declaration
alignment: function
alignment(velocity: Vec2, neighborVelocities: Vec2[]): Vec2 Parameters
- velocity: Vec2
- neighborVelocities: Vec2[]
Returns Vec2
arrive: function
arrive( position: Vec2, target: Vec2, velocity: Vec2, maxSpeed: number, slowRadius?: number,): Vec2 Parameters
- position: Vec2
- target: Vec2
- velocity: Vec2
- maxSpeed: number
- slowRadius: number = 100
Returns Vec2
cohesion: function
cohesion( position: Vec2, neighbors: Vec2[], velocity: Vec2, maxSpeed: number,): Vec2 Parameters
- position: Vec2
- neighbors: Vec2[]
- velocity: Vec2
- maxSpeed: number
Returns Vec2
evade: function
evade( position: Vec2, target: Vec2, targetVelocity: Vec2, velocity: Vec2, maxSpeed: number,): Vec2 Parameters
- position: Vec2
- target: Vec2
- targetVelocity: Vec2
- velocity: Vec2
- maxSpeed: number
Returns Vec2
flee: function
flee(position: Vec2, target: Vec2, velocity: Vec2, maxSpeed: number): Vec2 Parameters
- position: Vec2
- target: Vec2
- velocity: Vec2
- maxSpeed: number
Returns Vec2
obstacleAvoidance: function
obstacleAvoidance( position: Vec2, velocity: Vec2, obstacles: { radius: number; x: number; y: number }[], detectionRange?: number,): Vec2 Parameters
- position: Vec2
- velocity: Vec2
- obstacles: { radius: number; x: number; y: number }[]
- detectionRange: number = 100
Returns Vec2
pursue: function
pursue( position: Vec2, target: Vec2, targetVelocity: Vec2, velocity: Vec2, maxSpeed: number,): Vec2 Parameters
- position: Vec2
- target: Vec2
- targetVelocity: Vec2
- velocity: Vec2
- maxSpeed: number
Returns Vec2
seek: function
seek(position: Vec2, target: Vec2, velocity: Vec2, maxSpeed: number): Vec2 Parameters
- position: Vec2
- target: Vec2
- velocity: Vec2
- maxSpeed: number
Returns Vec2
separation: function
separation(position: Vec2, neighbors: Vec2[], desiredSeparation?: number): Vec2 Parameters
- position: Vec2
- neighbors: Vec2[]
- desiredSeparation: number = 50
Returns Vec2
wander: function
wander( velocity: Vec2, wanderDistance?: number, wanderRadius?: number, wanderAngle?: number,): { angle: number; force: Vec2 } Parameters
- velocity: Vec2
- wanderDistance: number = 50
- wanderRadius: number = 25
- wanderAngle: number = 0
Returns { angle: number; force: Vec2 }
Individual steering behavior functions. Each returns a force vector to apply to an entity.