Package net.dermetfan.gdx.physics.box2d
Class PositionController.D
java.lang.Object
net.dermetfan.gdx.physics.box2d.PositionController
net.dermetfan.gdx.physics.box2d.PositionController.D
- Enclosing class:
PositionController
the derivative control loop component
- Since:
- 0.11.1
-
Nested Class Summary
Nested classes/interfaces inherited from class net.dermetfan.gdx.physics.box2d.PositionController
PositionController.D, PositionController.P, PositionController.PD -
Field Summary
Fields inherited from class net.dermetfan.gdx.physics.box2d.PositionController
defaultUserDataAccessor, vec2 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatcalculateForce(float gain, float vel) static com.badlogic.gdx.math.Vector2calculateForce(float gainX, float gainY, float velX, float velY) static com.badlogic.gdx.math.Vector2calculateForce(com.badlogic.gdx.math.Vector2 gain, com.badlogic.gdx.math.Vector2 vel) com.badlogic.gdx.math.Vector2calculateForce(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 point) com.badlogic.gdx.math.Vector2calculateForceToCenter(com.badlogic.gdx.physics.box2d.Body body) com.badlogic.gdx.math.Vector2getGain()voidsetGain(com.badlogic.gdx.math.Vector2 gain) Methods inherited from class net.dermetfan.gdx.physics.box2d.PositionController
applyForce, applyForceToCenter, applyForceToCenter, getUserDataAccessor, setUserDataAccessor
-
Constructor Details
-
D
public D(float gain) - Parameters:
gain- the gain on both axes
-
D
public D(com.badlogic.gdx.math.Vector2 gain) - Parameters:
gain- thegain
-
-
Method Details
-
calculateForce
public static float calculateForce(float gain, float vel) - Parameters:
gain- the gainvel- the velocity- Returns:
gain * -vel
-
calculateForce
public static com.badlogic.gdx.math.Vector2 calculateForce(float gainX, float gainY, float velX, float velY) - Returns:
PositionController.vec2- See Also:
-
calculateForce
public static com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.math.Vector2 gain, com.badlogic.gdx.math.Vector2 vel) - See Also:
-
calculateForce
public com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 point) - Specified by:
calculateForcein classPositionController- Parameters:
point- the world point at which the force should be applied- Returns:
- the force to apply at the given point
-
calculateForceToCenter
public com.badlogic.gdx.math.Vector2 calculateForceToCenter(com.badlogic.gdx.physics.box2d.Body body) - Specified by:
calculateForceToCenterin classPositionController- Returns:
- the force to apply at the center of mass of the Body
-
getGain
public com.badlogic.gdx.math.Vector2 getGain()- Returns:
- the
gain
-
setGain
public void setGain(com.badlogic.gdx.math.Vector2 gain) - Parameters:
gain- thegainto set
-