Class PositionController.D

java.lang.Object
net.dermetfan.gdx.physics.box2d.PositionController
net.dermetfan.gdx.physics.box2d.PositionController.D
Enclosing class:
PositionController

public static class PositionController.D
extends PositionController
the derivative control loop component
Since:
0.11.1
  • 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 - the gain
  • Method Details

    • calculateForce

      public static float calculateForce​(float gain, float vel)
      Parameters:
      gain - the gain
      vel - 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(float, float)
    • calculateForce

      public static com.badlogic.gdx.math.Vector2 calculateForce​(com.badlogic.gdx.math.Vector2 gain, com.badlogic.gdx.math.Vector2 vel)
      See Also:
      calculateForce(float, float, float, float)
    • calculateForce

      public com.badlogic.gdx.math.Vector2 calculateForce​(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 point)
      Specified by:
      calculateForce in class PositionController
      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:
      calculateForceToCenter in class PositionController
      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 - the gain to set