new SteeringManager(vehicle)
Constructs a new steering manager.
Parameters:
Name | Type | Description |
---|---|---|
vehicle |
Vehicle | The vehicle that owns this steering manager. |
Members
-
readonly behaviors :Array.<SteeringBehavior>
-
A list of all steering behaviors.
-
vehicle :Vehicle
-
The vehicle that owns this steering manager.
Methods
-
add(behavior) → {SteeringManager}
-
Adds the given steering behavior to this steering manager.
Parameters:
Name Type Description behavior
SteeringBehavior The steering behavior to add.
-
calculate(delta, result) → {Vector3}
-
Calculates the steering forces for all active steering behaviors and combines it into a single result force. This method is called in Vehicle#update.
Parameters:
Name Type Description delta
Number The time delta.
result
Vector3 The force/result vector.
-
clear() → {SteeringManager}
-
Clears the internal state of this steering manager.
-
fromJSON(json) → {SteeringManager}
-
Restores this instance from the given JSON object.
Parameters:
Name Type Description json
Object The JSON object.
-
registerType(type, constructor) → {SteeringManager}
-
Registers a custom type for deserialization. When calling SteeringManager#fromJSON the steering manager is able to pick the correct constructor in order to create custom steering behavior.
Parameters:
Name Type Description type
String The name of the behavior type.
constructor
function The constructor function.
-
remove(behavior) → {SteeringManager}
-
Removes the given steering behavior from this steering manager.
Parameters:
Name Type Description behavior
SteeringBehavior The steering behavior to remove.
-
resolveReferences(entities) → {SteeringManager}
-
Restores UUIDs with references to GameEntity objects.
Parameters:
Name Type Description entities
Map.<String, GameEntity> Maps game entities to UUIDs.
-
toJSON() → {Object}
-
Transforms this instance into a JSON object.
Returns:
Object -The JSON object.