WanderBehavior(radius, distance, jitter)

This steering behavior produces a steering force that will give the impression of a random walk through the agent’s environment. The behavior only produces a 2D force (XZ).

new WanderBehavior(radius, distance, jitter)

Constructs a new wander behavior.

Parameters:
Name Type Default Description
radius Number 1

The radius of the wander circle for the wander behavior.

distance Number 5

The distance the wander circle is projected in front of the agent.

jitter Number 5

The maximum amount of displacement along the sphere each frame.

Author:

Extends

Members

active :Boolean

Whether this steering behavior is active or not.

Overrides:
Default Value:
  • true

distance :Number

The distance the wander sphere is projected in front of the agent.

Default Value:
  • 5

jitter :Number

The maximum amount of displacement along the sphere each frame.

Default Value:
  • 5

radius :Number

The radius of the constraining circle for the wander behavior.

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) → {WanderBehavior}

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
WanderBehavior -

A reference to this behavior.

Overrides:

resolveReferences(entities) → {SteeringBehavior}

Restores UUIDs with references to GameEntity objects.

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

Maps game entities to UUIDs.

Returns:
SteeringBehavior -

A reference to this steering behavior.

Overrides:

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.

Overrides: