T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class MatchVelocity<T extends com.badlogic.gdx.math.Vector<T>> extends SteeringBehavior<T>
| Modifier and Type | Field and Description |
|---|---|
protected Steerable<T> |
target
The target of this behavior
|
protected float |
timeToTarget
The time over which to achieve target speed
|
enabled, limiter, owner| Constructor and Description |
|---|
MatchVelocity(Steerable<T> owner)
Creates a
MatchVelocity behavior for the given owner. |
MatchVelocity(Steerable<T> owner,
Steerable<T> target)
Creates a
MatchVelocity behavior for the given owner and target. |
MatchVelocity(Steerable<T> owner,
Steerable<T> target,
float timeToTarget)
Creates a
MatchVelocity behavior for the given owner, target and timeToTarget. |
| 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.
|
Steerable<T> |
getTarget()
Returns the target whose velocity should be matched.
|
float |
getTimeToTarget()
Returns the time over which to achieve target speed.
|
MatchVelocity<T> |
setEnabled(boolean enabled)
Sets this steering behavior on/off.
|
MatchVelocity<T> |
setLimiter(Limiter limiter)
Sets the limiter of this steering behavior.
|
MatchVelocity<T> |
setOwner(Steerable<T> owner)
Sets the owner of this steering behavior.
|
MatchVelocity<T> |
setTarget(Steerable<T> target)
Sets the target whose velocity should be matched.
|
MatchVelocity<T> |
setTimeToTarget(float timeToTarget)
Sets the time over which to achieve target speed.
|
calculateSteering, getActualLimiter, getLimiter, getOwner, isEnabled, newVectorprotected Steerable<T extends com.badlogic.gdx.math.Vector<T>> target
protected float timeToTarget
public MatchVelocity(Steerable<T> owner)
MatchVelocity behavior for the given owner. No target is set. The maxLinearAcceleration is set to 100. The
timeToTarget is set to 0.1 seconds.owner - the owner of this behavior.public MatchVelocity(Steerable<T> owner, Steerable<T> target)
MatchVelocity behavior for the given owner and target. The timeToTarget is set to 0.1 seconds.owner - the owner of this behaviortarget - the target of this behavior.public MatchVelocity(Steerable<T> owner, Steerable<T> target, float timeToTarget)
MatchVelocity behavior for the given owner, target and timeToTarget.owner - the owner of this behaviortarget - the target of this behaviortimeToTarget - the time over which to achieve target speed.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.public MatchVelocity<T> setTarget(Steerable<T> target)
target - the target to setpublic float getTimeToTarget()
public MatchVelocity<T> setTimeToTarget(float timeToTarget)
timeToTarget - the time to setpublic MatchVelocity<T> setOwner(Steerable<T> owner)
SteeringBehaviorsetOwner in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public MatchVelocity<T> setEnabled(boolean enabled)
SteeringBehaviorsetEnabled in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>public MatchVelocity<T> setLimiter(Limiter limiter)
setLimiter in class SteeringBehavior<T extends com.badlogic.gdx.math.Vector<T>>