T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class BlendedSteering<T extends com.badlogic.gdx.math.Vector<T>> extends SteeringBehavior<T>
BlendedSteering as a weighted mean, because it's not.
With BlendedSteering you can combine multiple behaviors to get a more complex behavior. It can work fine, but the
trade-off is that it comes with a few problems:
| Modifier and Type | Class and Description |
|---|---|
static class |
BlendedSteering.BehaviorAndWeight<T extends com.badlogic.gdx.math.Vector<T>> |
| Modifier and Type | Field and Description |
|---|---|
protected com.badlogic.gdx.utils.Array<BlendedSteering.BehaviorAndWeight<T>> |
list
The list of behaviors and their corresponding blending weights.
|
enabled, limiter, owner| Constructor and Description |
|---|
BlendedSteering(Steerable<T> owner)
Creates a
BlendedSteering for the specified owner, maxLinearAcceleration and
maxAngularAcceleration. |
| Modifier and Type | Method and Description |
|---|---|
BlendedSteering<T> |
add(BlendedSteering.BehaviorAndWeight<T> item)
Adds a steering behavior and its weight to the list.
|
BlendedSteering<T> |
add(SteeringBehavior<T> behavior,
float weight)
Adds a steering behavior and its weight to the list.
|
protected SteeringAcceleration<T> |
calculateRealSteering(SteeringAcceleration<T> blendedSteering)
Calculates the steering acceleration produced by this behavior and writes it to the given steering output.
|
BlendedSteering.BehaviorAndWeight<T> |
get(int index)
Returns the weighted behavior at the specified index.
|
void |
remove(BlendedSteering.BehaviorAndWeight<T> item)
Removes a steering behavior from the list.
|
void |
remove(SteeringBehavior<T> behavior)
Removes a steering behavior from the list.
|
BlendedSteering<T> |
setEnabled(boolean enabled)
Sets this steering behavior on/off.
|
BlendedSteering<T> |
setLimiter(Limiter limiter)
Sets the limiter of this steering behavior.
|
BlendedSteering<T> |
setOwner(Steerable<T> owner)
Sets the owner of this steering behavior.
|
calculateSteering, getActualLimiter, getLimiter, getOwner, isEnabled, newVectorprotected com.badlogic.gdx.utils.Array<BlendedSteering.BehaviorAndWeight<T extends com.badlogic.gdx.math.Vector<T>>> list
public BlendedSteering<T> add(SteeringBehavior<T> behavior, float weight)
behavior - the steering behavior to addweight - the weight of the behaviorpublic BlendedSteering<T> add(BlendedSteering.BehaviorAndWeight<T> item)
item - the steering behavior and its weightpublic void remove(BlendedSteering.BehaviorAndWeight<T> item)
item - the steering behavior to removepublic void remove(SteeringBehavior<T> behavior)
behavior - the steering behavior to removepublic BlendedSteering.BehaviorAndWeight<T> get(int index)
index - the index of the weighted behavior to returnprotected SteeringAcceleration<T> calculateRealSteering(SteeringAcceleration<T> blendedSteering)
SteeringBehavior
This method is called by SteeringBehavior.calculateSteering(SteeringAcceleration) when this steering behavior is enabled.
calculateRealSteering in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>blendedSteering - the steering acceleration to be calculated.public BlendedSteering<T> setOwner(Steerable<T> owner)
SteeringBehaviorsetOwner in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public BlendedSteering<T> setEnabled(boolean enabled)
SteeringBehaviorsetEnabled in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public BlendedSteering<T> setLimiter(Limiter limiter)
NullLimiter.NEUTRAL_LIMITER to avoid all truncations.setLimiter in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>