PursuitBehavior(evader, predictionFactor)

This steering behavior is useful when an agent is required to intercept a moving agent.

new PursuitBehavior(evader, predictionFactor)

Constructs a new pursuit behavior.

Parameters:
Name Type Default Description
evader MovingEntity null

The agent to pursue.

predictionFactor Number 1

This factor determines how far the vehicle predicts the movement of the evader.

Author:

Extends

Members

active :Boolean

Whether this steering behavior is active or not.

Overrides:
Default Value:
  • true

nullable evader :MovingEntity

The agent to pursue.

Default Value:
  • null

predictionFactor :Number

This factor determines how far the vehicle predicts the movement of the evader.

Default Value:
  • 1

weight :Number

Can be used to tweak the amount that a steering force contributes to the total steering force.

Overrides:
Default Value:
  • 1

Methods

calculate(vehicle, force, delta) → {Vector3}

Calculates the steering force for a single simulation step.

Parameters:
Name Type Description
vehicle Vehicle

The game entity the force is produced for.

force Vector3

The force/result vector.

delta Number

The time delta.

Returns:
Vector3 -

The force/result vector.

Overrides:

fromJSON(json) → {PursuitBehavior}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
PursuitBehavior -

A reference to this behavior.

Overrides:

resolveReferences(entities) → {PursuitBehavior}

Restores UUIDs with references to GameEntity objects.

Parameters:
Name Type Description
entities Map.<String, GameEntity>

Maps game entities to UUIDs.

Returns:
PursuitBehavior -

A reference to this behavior.

Overrides:

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.

Overrides: