InterposeBehavior(entity1, entity2, deceleration)

This steering behavior produces a force that moves a vehicle to the midpoint of the imaginary line connecting two other agents.

new InterposeBehavior(entity1, entity2, deceleration)

Constructs a new interpose behavior.

Parameters:
Name Type Default Description
entity1 MovingEntity null

The first agent.

entity2 MovingEntity null

The second agent.

deceleration Number 3

The amount of deceleration.

Author:

Extends

Members

active :Boolean

Whether this steering behavior is active or not.

Overrides:
Default Value:
  • true

deceleration :Number

The amount of deceleration.

Default Value:
  • 3

nullable entity1 :MovingEntity

The first agent.

Default Value:
  • null

nullable entity2 :MovingEntity

The second agent.

Default Value:
  • null

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

Restores this instance from the given JSON object.

Parameters:
Name Type Description
json Object

The JSON object.

Returns:
InterposeBehavior -

A reference to this behavior.

Overrides:

resolveReferences(entities) → {InterposeBehavior}

Restores UUIDs with references to GameEntity objects.

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

Maps game entities to UUIDs.

Returns:
InterposeBehavior -

A reference to this behavior.

Overrides:

toJSON() → {Object}

Transforms this instance into a JSON object.

Returns:
Object -

The JSON object.

Overrides: