Class MotorcycleController

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class MotorcycleController extends WheeledVehicleController
Control the acceleration and balance of a motorcycle, in addition to its acceleration and deceleration.
  • Method Details

    • enableLeanController

      public void enableLeanController(boolean enable)
      Enable or disable the lean spring.
      Parameters:
      enable - true to enable the spring, false to disable it
    • enableLeanSteeringLimit

      public void enableLeanSteeringLimit(boolean enable)
      Enable or disable the lean steering limit.
      Parameters:
      enable - true to limit steering based on speed, false to stop limiting it
    • getLeanSmoothingFactor

      public float getLeanSmoothingFactor()
      Return the smoothing factor for the lean angle. The vehicle controller is unaffected.
      Returns:
      the factor (0=no smoothing, 1=lean angle frozen)
    • getLeanSpringConstant

      public float getLeanSpringConstant()
      Return the stiffness of the lean spring. The vehicle controller is unaffected.
      Returns:
      the spring constant
    • getLeanSpringDamping

      public float getLeanSpringDamping()
      Return the damping constant of the lean spring. The vehicle controller is unaffected.
      Returns:
      the damping constant
    • getLeanSpringIntegrationCoefficient

      public float getLeanSpringIntegrationCoefficient()
      Return the coefficient of the integral term. The vehicle controller is unaffected.
      Returns:
      the force coefficient
    • getLeanSpringIntegrationCoefficientDecay

      public float getLeanSpringIntegrationCoefficientDecay()
      Return the decay rate of the integral term when the motorcycle is unsupported. The vehicle controller is unaffected.
      Returns:
      the rate (per second)
    • getWheelBase

      public float getWheelBase()
      Return the distance between the front and back wheels. The vehicle controller is unaffected.
      Returns:
      the distance (in meters)
    • isLeanControllerEnabled

      public boolean isLeanControllerEnabled()
      Test whether the lean spring is enabled. The vehicle controller is unaffected.
      Returns:
      true if enabled, otherwise false
    • isLeanSteeringLimitEnabled

      public boolean isLeanSteeringLimitEnabled()
      Test whether the lean steering limit is enabled. The vehicle controller is unaffected.
      Returns:
      true if enabled, otherwise false
    • setLeanSmoothingFactor

      public void setLeanSmoothingFactor(float factor)
      Alter the smoothing factor for the lean angle.
      Parameters:
      factor - the desired smoothing factor (0=no smoothing, 1=lean angle frozen)
    • setLeanSpringConstant

      public void setLeanSpringConstant(float constant)
      Alter the stiffness of the lean spring.
      Parameters:
      constant - the desired spring constant
    • setLeanSpringDamping

      public void setLeanSpringDamping(float damping)
      Alter the damping constant of the lean spring.
      Parameters:
      damping - the desired damping constant
    • setLeanSpringIntegrationCoefficient

      public void setLeanSpringIntegrationCoefficient(float coefficient)
      Return the coefficient of the integral term.
      Parameters:
      coefficient - the desired force coefficient
    • setLeanSpringIntegrationCoefficientDecay

      public void setLeanSpringIntegrationCoefficientDecay(float decay)
      Alter the decay rate of the integral term when the motorcycle is unsupported.
      Parameters:
      decay - the desired rate (per second)