T - Type of vector, either 2D or 3D, implementing the Vector interfacepublic class SteeringAcceleration<T extends com.badlogic.gdx.math.Vector<T>>
extends java.lang.Object
SteeringAcceleration is a movement requested by the steering system. It is made up of two components, linear and angular
acceleration.| Modifier and Type | Field and Description |
|---|---|
float |
angular
The angular component of this steering acceleration.
|
T |
linear
The linear component of this steering acceleration.
|
| Constructor and Description |
|---|
SteeringAcceleration(T linear)
Creates a
SteeringAcceleration with the given linear acceleration and zero angular acceleration. |
SteeringAcceleration(T linear,
float angular)
Creates a
SteeringAcceleration with the given linear and angular components. |
| Modifier and Type | Method and Description |
|---|---|
SteeringAcceleration<T> |
add(SteeringAcceleration<T> steering)
Adds the given steering acceleration to this steering acceleration.
|
float |
calculateMagnitude()
Returns the magnitude of this steering acceleration.
|
float |
calculateSquareMagnitude()
Returns the square of the magnitude of this steering acceleration.
|
boolean |
isZero()
Returns
true if both linear and angular components of this steering acceleration are zero; false otherwise. |
SteeringAcceleration<T> |
mulAdd(SteeringAcceleration<T> steering,
float scalar)
First scale a supplied steering acceleration, then add it to this steering acceleration.
|
SteeringAcceleration<T> |
scl(float scalar)
Scales this steering acceleration by the specified scalar.
|
SteeringAcceleration<T> |
setZero()
Zeros the linear and angular components of this steering acceleration.
|
public T extends com.badlogic.gdx.math.Vector<T> linear
public float angular
public SteeringAcceleration(T linear)
SteeringAcceleration with the given linear acceleration and zero angular acceleration.linear - The initial linear acceleration to give this SteeringAcceleration.public SteeringAcceleration(T linear, float angular)
SteeringAcceleration with the given linear and angular components.linear - The initial linear acceleration to give this SteeringAcceleration.angular - The initial angular acceleration to give this SteeringAcceleration.public boolean isZero()
true if both linear and angular components of this steering acceleration are zero; false otherwise.public SteeringAcceleration<T> setZero()
public SteeringAcceleration<T> add(SteeringAcceleration<T> steering)
steering - the steering accelerationpublic SteeringAcceleration<T> scl(float scalar)
scalar - the scalarpublic SteeringAcceleration<T> mulAdd(SteeringAcceleration<T> steering, float scalar)
steering - the steering accelerationscalar - the scalarpublic float calculateSquareMagnitude()
public float calculateMagnitude()