public abstract class PositionController
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PositionController.D
the derivative control loop component
|
static class |
PositionController.P
the proportional control loop component
|
static class |
PositionController.PD
a proportional-derivative controller
|
| Modifier and Type | Field and Description |
|---|---|
static net.dermetfan.utils.Function<java.lang.Object,PositionController> |
defaultUserDataAccessor
returns the argument if it is a PositionController
|
private static net.dermetfan.utils.Function<java.lang.Object,PositionController> |
userDataAccessor
the Function used to extract a PositionController out of a Body's user data
|
protected static com.badlogic.gdx.math.Vector2 |
vec2
shared instance for internal use
|
| Constructor and Description |
|---|
PositionController() |
| Modifier and Type | Method and Description |
|---|---|
com.badlogic.gdx.math.Vector2 |
applyForce(com.badlogic.gdx.physics.box2d.Body body,
com.badlogic.gdx.math.Vector2 point,
boolean wake)
applies the necessary force at the given point
|
com.badlogic.gdx.math.Vector2 |
applyForceToCenter(com.badlogic.gdx.physics.box2d.Body body,
boolean wake)
applies the necessary force at the center of mass of the Body
|
static void |
applyForceToCenter(com.badlogic.gdx.physics.box2d.World world,
boolean wake)
Calls
applyForceToCenter for every Body with a PositionController in its user data. |
abstract com.badlogic.gdx.math.Vector2 |
calculateForce(com.badlogic.gdx.physics.box2d.Body body,
com.badlogic.gdx.math.Vector2 point) |
abstract com.badlogic.gdx.math.Vector2 |
calculateForceToCenter(com.badlogic.gdx.physics.box2d.Body body) |
static net.dermetfan.utils.Function<java.lang.Object,PositionController> |
getUserDataAccessor() |
static void |
setUserDataAccessor(net.dermetfan.utils.Function<java.lang.Object,PositionController> userDataAccessor) |
protected static final com.badlogic.gdx.math.Vector2 vec2
public static final net.dermetfan.utils.Function<java.lang.Object,PositionController> defaultUserDataAccessor
private static net.dermetfan.utils.Function<java.lang.Object,PositionController> userDataAccessor
public static void applyForceToCenter(com.badlogic.gdx.physics.box2d.World world,
boolean wake)
applyForceToCenter for every Body with a PositionController in its user data.
The PositionController is accessed using the userDataAccessor.world - the world which Bodies to iterate overpublic abstract com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.physics.box2d.Body body,
com.badlogic.gdx.math.Vector2 point)
point - the world point at which the force should be appliedpublic abstract com.badlogic.gdx.math.Vector2 calculateForceToCenter(com.badlogic.gdx.physics.box2d.Body body)
public com.badlogic.gdx.math.Vector2 applyForce(com.badlogic.gdx.physics.box2d.Body body,
com.badlogic.gdx.math.Vector2 point,
boolean wake)
point - the world point at which to apply the forcecalculateForce(Body, Vector2)public com.badlogic.gdx.math.Vector2 applyForceToCenter(com.badlogic.gdx.physics.box2d.Body body,
boolean wake)
calculateForceToCenter(Body)public static net.dermetfan.utils.Function<java.lang.Object,PositionController> getUserDataAccessor()
userDataAccessorpublic static void setUserDataAccessor(net.dermetfan.utils.Function<java.lang.Object,PositionController> userDataAccessor)
userDataAccessor - The userDataAccessor to set. If null, defaultUserDataAccessor is set.