Package net.dermetfan.gdx.physics.box2d
Class PositionController.PD
java.lang.Object
net.dermetfan.gdx.physics.box2d.PositionController
net.dermetfan.gdx.physics.box2d.PositionController.PD
- Enclosing class:
 - PositionController
 
public static class PositionController.PD extends PositionController
a proportional-derivative controller
- Since:
 - 0.11.1
 - See Also:
 PositionController.P,PositionController.D
- 
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
 - 
Method Summary
Modifier and Type Method Description static floatcalculateForce(float gainP, float gainD, float pos, float dest, float vel)static com.badlogic.gdx.math.Vector2calculateForce(float gainPX, float gainPY, float gainDX, float gainDY, float posX, float posY, float destX, float destY, float velX, float velY)static com.badlogic.gdx.math.Vector2calculateForce(com.badlogic.gdx.math.Vector2 gainP, com.badlogic.gdx.math.Vector2 gainD, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dest, 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.Vector2getDestination()com.badlogic.gdx.math.Vector2getGainD()com.badlogic.gdx.math.Vector2getGainP()voidsetDestination(com.badlogic.gdx.math.Vector2 destination)voidsetGainD(com.badlogic.gdx.math.Vector2 gainD)voidsetGainP(com.badlogic.gdx.math.Vector2 gainP)Methods inherited from class net.dermetfan.gdx.physics.box2d.PositionController
applyForce, applyForceToCenter, applyForceToCenter, getUserDataAccessor, setUserDataAccessorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Constructor Details
- 
PD
public PD(float gainP, float gainD, com.badlogic.gdx.math.Vector2 destination)- Parameters:
 gainP- the proportional gain on both axesgainD- the derivative gain on both axesdestination- thedestination
 - 
PD
public PD(com.badlogic.gdx.math.Vector2 gainP, com.badlogic.gdx.math.Vector2 gainD, com.badlogic.gdx.math.Vector2 destination)- Parameters:
 gainP- thegainPgainD- thegainDdestination- thedestination
 
 - 
 - 
Method Details
- 
calculateForce
public static float calculateForce(float gainP, float gainD, float pos, float dest, float vel) - 
calculateForce
public static com.badlogic.gdx.math.Vector2 calculateForce(float gainPX, float gainPY, float gainDX, float gainDY, float posX, float posY, float destX, float destY, float velX, float velY) - 
calculateForce
public static com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.math.Vector2 gainP, com.badlogic.gdx.math.Vector2 gainD, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dest, com.badlogic.gdx.math.Vector2 vel) - 
calculateForce
public com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 point)- Specified by:
 calculateForcein classPositionControllerpoint- 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
 
 - 
getGainP
public com.badlogic.gdx.math.Vector2 getGainP()- Returns:
 - the 
gainP 
 - 
setGainP
public void setGainP(com.badlogic.gdx.math.Vector2 gainP)- Parameters:
 gainP- thegainPto set
 - 
getGainD
public com.badlogic.gdx.math.Vector2 getGainD()- Returns:
 - the 
gainD 
 - 
setGainD
public void setGainD(com.badlogic.gdx.math.Vector2 gainD)- Parameters:
 gainD- thegainDto set
 - 
getDestination
public com.badlogic.gdx.math.Vector2 getDestination()- Returns:
 - the 
destination 
 - 
setDestination
public void setDestination(com.badlogic.gdx.math.Vector2 destination)- Parameters:
 destination- thedestinationto set
 
 -