T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class LookWhereYouAreGoing<T extends com.badlogic.gdx.math.Vector<T>> extends ReachOrientation<T>
LookWhereYouAreGoing
behavior.
LookWhereYouAreGoing behavior gives the owner angular acceleration to make it face in the direction it is moving. In
this way the owner changes facing gradually, which can look more natural, especially for aerial vehicles such as helicopters or
for human characters that can move sideways.
This is a process similar to the Face behavior. The target orientation is calculated using the current velocity of the
owner. If there is no velocity, then the target orientation is set to the current orientation. We have no preference in this
situation for any orientation.
alignTolerance, decelerationRadius, target, timeToTargetenabled, limiter, owner| Constructor and Description |
|---|
LookWhereYouAreGoing(Steerable<T> owner)
Creates a
LookWhereYouAreGoing behavior for the specified owner. |
| 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.
|
LookWhereYouAreGoing<T> |
setAlignTolerance(float alignTolerance)
Sets the tolerance for aligning to the target without letting small errors keep the owner swinging.
|
LookWhereYouAreGoing<T> |
setDecelerationRadius(float decelerationRadius)
Sets the radius for beginning to slow down
|
LookWhereYouAreGoing<T> |
setEnabled(boolean enabled)
Sets this steering behavior on/off.
|
LookWhereYouAreGoing<T> |
setLimiter(Limiter limiter)
Sets the limiter of this steering behavior.
|
LookWhereYouAreGoing<T> |
setOwner(Steerable<T> owner)
Sets the owner of this steering behavior.
|
LookWhereYouAreGoing<T> |
setTarget(Location<T> target)
Sets the target to align to.
|
LookWhereYouAreGoing<T> |
setTimeToTarget(float timeToTarget)
Sets the time over which to achieve target rotation speed
|
getAlignTolerance, getDecelerationRadius, getTarget, getTimeToTarget, reachOrientationcalculateSteering, 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 ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>steering - the steering acceleration to be calculated.public LookWhereYouAreGoing<T> setOwner(Steerable<T> owner)
SteeringBehaviorsetOwner in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>public LookWhereYouAreGoing<T> setEnabled(boolean enabled)
SteeringBehaviorsetEnabled in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>public LookWhereYouAreGoing<T> setLimiter(Limiter limiter)
setLimiter in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>public LookWhereYouAreGoing<T> setTarget(Location<T> target)
ReachOrientation, but is completely useless
for LookWhereYouAreGoing because the target orientation is determined by the velocity of the owner itself.setTarget in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>public LookWhereYouAreGoing<T> setAlignTolerance(float alignTolerance)
ReachOrientationsetAlignTolerance in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>public LookWhereYouAreGoing<T> setDecelerationRadius(float decelerationRadius)
ReachOrientationsetDecelerationRadius in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>public LookWhereYouAreGoing<T> setTimeToTarget(float timeToTarget)
ReachOrientationsetTimeToTarget in class ReachOrientation<T extends com.badlogic.gdx.math.Vector<T>>