T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>> extends SteeringBehavior<T>
ReachOrientation tries to align the owner to the target. It pays no attention to the position or velocity of the owner
or target. This steering behavior does not produce any linear acceleration; it only responds by turning.
ReachOrientation behaves in a similar way to Arrive since it tries to reach the target orientation and tries to
have zero rotation when it gets there. Like arrive, it uses two radii: decelerationRadius for slowing down and
alignTolerance to make orientations near the target acceptable without letting small errors keep the owner swinging.
Because we are dealing with a single scalar value, rather than a 2D or 3D vector, the radius acts as an interval.
Similarly to Arrive, there is a timeToTarget that defaults to 0.1 seconds.
| Modifier and Type | Field and Description |
|---|---|
protected float |
alignTolerance
The tolerance for aligning to the target without letting small errors keep the owner swinging.
|
protected float |
decelerationRadius
The radius for beginning to slow down
|
protected Location<T> |
target
The target to align to.
|
protected float |
timeToTarget
The time over which to achieve target rotation speed
|
enabled, limiter, owner| Constructor and Description |
|---|
ReachOrientation(Steerable<T> owner)
Creates a
ReachOrientation behavior for the specified owner. |
ReachOrientation(Steerable<T> owner,
Location<T> target)
Creates a
ReachOrientation behavior for the specified owner and target. |
| 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 |
getAlignTolerance()
Returns the tolerance for aligning to the target without letting small errors keep the owner swinging.
|
float |
getDecelerationRadius()
Returns the radius for beginning to slow down
|
Location<T> |
getTarget()
Returns the target to align to.
|
float |
getTimeToTarget()
Returns the time over which to achieve target rotation speed
|
protected SteeringAcceleration<T> |
reachOrientation(SteeringAcceleration<T> steering,
float targetOrientation)
Produces a steering that tries to align the owner to the target orientation.
|
ReachOrientation<T> |
setAlignTolerance(float alignTolerance)
Sets the tolerance for aligning to the target without letting small errors keep the owner swinging.
|
ReachOrientation<T> |
setDecelerationRadius(float decelerationRadius)
Sets the radius for beginning to slow down
|
ReachOrientation<T> |
setEnabled(boolean enabled)
Sets this steering behavior on/off.
|
ReachOrientation<T> |
setLimiter(Limiter limiter)
Sets the limiter of this steering behavior.
|
ReachOrientation<T> |
setOwner(Steerable<T> owner)
Sets the owner of this steering behavior.
|
ReachOrientation<T> |
setTarget(Location<T> target)
Sets the target to align to.
|
ReachOrientation<T> |
setTimeToTarget(float timeToTarget)
Sets the time over which to achieve target rotation speed
|
calculateSteering, getActualLimiter, getLimiter, getOwner, isEnabled, newVectorprotected float alignTolerance
protected float decelerationRadius
protected float timeToTarget
public ReachOrientation(Steerable<T> owner)
ReachOrientation behavior for the specified owner.owner - the owner of this behavior.protected 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.protected SteeringAcceleration<T> reachOrientation(SteeringAcceleration<T> steering, float targetOrientation)
steering - the steering to be calculated.targetOrientation - the target orientation you want to align to.public ReachOrientation<T> setTarget(Location<T> target)
public float getAlignTolerance()
public ReachOrientation<T> setAlignTolerance(float alignTolerance)
public float getDecelerationRadius()
public ReachOrientation<T> setDecelerationRadius(float decelerationRadius)
public float getTimeToTarget()
public ReachOrientation<T> setTimeToTarget(float timeToTarget)
public ReachOrientation<T> setOwner(Steerable<T> owner)
SteeringBehaviorsetOwner in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public ReachOrientation<T> setEnabled(boolean enabled)
SteeringBehaviorsetEnabled in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public ReachOrientation<T> setLimiter(Limiter limiter)
setLimiter in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>