Class VehicleEngine

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

public class VehicleEngine extends VehicleEngineSettings
The engine of a VehicleController.
  • Method Details

    • allowSleep

      public boolean allowSleep()
      Test whether the vehicle is allowed to sleep.
      Returns:
      true if allowed, otherwise false
    • applyDamping

      public void applyDamping(float deltaTime)
      Update the engine RPM for damping.
      Parameters:
      deltaTime - the amount of time between updates (in seconds, ≥0)
    • applyTorque

      public void applyTorque(float torque, float deltaTime)
      Apply the specified torque to the engine.
      Parameters:
      torque - the torque to apply (in Newton.meters)
      deltaTime - the amount of time between updates (in seconds, ≥0)
    • clampRpm

      public void clampRpm()
      Clamp the engine's RPM between its minimum and maximum values.
    • getAngularVelocity

      public float getAngularVelocity()
      Return the engine's rotation rate in SI units.
      Returns:
      the speed (in radians per second)
    • getCurrentRpm

      public float getCurrentRpm()
      Return the engine's rotation rate in traditional units.
      Returns:
      the rate (in revolutions per minute)
    • getTorque

      public float getTorque(float acceleration)
      Return how much torque the engine can supply for the specified acceleration.
      Parameters:
      acceleration - the position of the accelerator pedal (≥0, ≤1)
      Returns:
      the available torque (in Newton.meters)
    • setCurrentRpm

      public void setCurrentRpm(float rpm)
      Alter the engine's rotation rate.
      Parameters:
      rpm - the desired rate (in revolutions per minute)