new EvadeBehavior(pursuer, panicDistance, predictionFactor)
Constructs a new evade behavior.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
pursuer |
MovingEntity | null | The agent to evade from. |
panicDistance |
Number | 10 | The agent only flees from the pursuer if it is inside this radius. |
predictionFactor |
Number | 1 | This factor determines how far the vehicle predicts the movement of the pursuer. |
Extends
Members
-
active :Boolean
-
Whether this steering behavior is active or not.
- Overrides:
- Default Value:
- true
-
panicDistance :Number
-
The agent only flees from the pursuer if it is inside this radius.
- Default Value:
- 10
-
predictionFactor :Number
-
This factor determines how far the vehicle predicts the movement of the pursuer.
- Default Value:
- 1
-
nullable pursuer :MovingEntity
-
The agent to evade from.
- 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.
- Overrides:
-
fromJSON(json) → {EvadeBehavior}
-
Restores this instance from the given JSON object.
Parameters:
Name Type Description json
Object The JSON object.
- Overrides:
-
resolveReferences(entities) → {EvadeBehavior}
-
Restores UUIDs with references to GameEntity objects.
Parameters:
Name Type Description entities
Map.<String, GameEntity> Maps game entities to UUIDs.
- Overrides:
-
toJSON() → {Object}
-
Transforms this instance into a JSON object.
Returns:
Object -The JSON object.
- Overrides: