T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class Separation<T extends com.badlogic.gdx.math.Vector<T>> extends GroupBehavior<T> implements Proximity.ProximityCallback<T>
Separation is a group behavior producing a steering acceleration repelling from the other neighbors which are the agents
in the immediate area defined by the given Proximity. The acceleration is calculated by iterating through all the
neighbors, examining each one. The vector to each agent under consideration is normalized, multiplied by a strength decreasing
according to the inverse square law in relation to distance, and accumulated.proximityenabled, limiter, owner| Constructor and Description |
|---|
Separation(Steerable<T> owner,
Proximity<T> proximity)
Creates a
Separation behavior for the specified owner and proximity. |
| Modifier and Type | Method and Description |
|---|---|
protected SteeringAcceleration<T> |
calculateRealSteering(SteeringAcceleration<T> steering)
Calculates the steering acceleration produced by this behavior and writes it to the given steering output.
|
float |
getDecayCoefficient()
Returns the coefficient of decay for the inverse square law force.
|
boolean |
reportNeighbor(Steerable<T> neighbor)
The callback method used to report a neighbor.
|
Separation<T> |
setDecayCoefficient(float decayCoefficient)
Sets the coefficient of decay for the inverse square law force.
|
Separation<T> |
setEnabled(boolean enabled)
Sets this steering behavior on/off.
|
Separation<T> |
setLimiter(Limiter limiter)
Sets the limiter of this steering behavior.
|
Separation<T> |
setOwner(Steerable<T> owner)
Sets the owner of this steering behavior.
|
getProximity, setProximitycalculateSteering, getActualLimiter, getLimiter, getOwner, isEnabled, newVectorprotected SteeringAcceleration<T> calculateRealSteering(SteeringAcceleration<T> steering)
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>>steering - the steering acceleration to be calculated.public boolean reportNeighbor(Steerable<T> neighbor)
Proximity.ProximityCallbackreportNeighbor in interface Proximity.ProximityCallback<T extends com.badlogic.gdx.math.Vector<T>>neighbor - the reported neighbor.true if the given neighbor is valid; false otherwise.public float getDecayCoefficient()
public Separation<T> setDecayCoefficient(float decayCoefficient)
decayCoefficient - the coefficient of decay to setpublic Separation<T> setOwner(Steerable<T> owner)
SteeringBehaviorsetOwner in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public Separation<T> setEnabled(boolean enabled)
SteeringBehaviorsetEnabled in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public Separation<T> setLimiter(Limiter limiter)
setLimiter in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>