Class VehicleTuning

java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.objects.infos.VehicleTuning
All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable, Comparable<NativePhysicsObject>

public class VehicleTuning extends NativePhysicsObject implements com.jme3.util.clone.JmeCloneable, com.jme3.export.Savable
Tuning parameters for a PhysicsVehicle, based on Bullet's btVehicleTuning.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • VehicleTuning

      public VehicleTuning()
      Instantiate an instance with the default parameter values.
  • Method Details

    • getFrictionSlip

      public float getFrictionSlip()
      Return the friction between tires and ground (native field: m_frictionSlip).
      Returns:
      the coefficient of friction
    • getMaxSuspensionForce

      public float getMaxSuspensionForce()
      Return the maximum force exerted by each wheel's suspension (native field: m_maxSuspensionForce).
      Returns:
      the maximum force
    • getMaxSuspensionTravelCm

      public float getMaxSuspensionTravelCm()
      Determine the maximum travel distance for each wheel's suspension (native field: m_maxSuspensionTravelCm).

      Note that the units are centimeters ONLY if the physics-space unit is exactly one meter.

      Returns:
      the maximum amount the suspension can be compressed or expanded, relative to its rest length (in hundredths of a physics-space unit)
    • getSuspensionCompression

      public float getSuspensionCompression()
      Return the suspension damping when compressed (native field: m_suspensionCompression).
      Returns:
      the damping amount
    • getSuspensionDamping

      public float getSuspensionDamping()
      Return the suspension damping when expanded (native field: m_suspensionDamping).
      Returns:
      the damping amount (0→no damping, default=0.88)
    • getSuspensionStiffness

      public float getSuspensionStiffness()
      Return the suspension stiffness (native field: m_suspensionStiffness).
      Returns:
      the stiffness constant
    • setFrictionSlip

      public void setFrictionSlip(float coeff)
      Alter the friction between tires and ground (native field: m_frictionSlip).
      Parameters:
      coeff - the desired coefficient of friction (0.8→realistic car, 10000→kart racer, default=10.5)
    • setMaxSuspensionForce

      public void setMaxSuspensionForce(float maxForce)
      Alter the force exerted by each wheel's suspension (native field: m_maxSuspensionForce).
      Parameters:
      maxForce - the desired maximum force (default=6000)
    • setMaxSuspensionTravelCm

      public void setMaxSuspensionTravelCm(float travelCm)
      Alter the maximum travel distance for the suspension (native field: m_maxSuspensionTravelCm). Note that the units are centimeters ONLY if the physics-space unit is exactly one meter.
      Parameters:
      travelCm - the desired maximum amount the suspension can be compressed or expanded, relative to its rest length (in hundredths of a physics-space unit, default=500)
    • setSuspensionCompression

      public void setSuspensionCompression(float damping)
      Alter the suspension damping when compressed (native field: m_suspensionCompression).
      Parameters:
      damping - the desired damping amount (0→no damping, default=0.83)
    • setSuspensionDamping

      public void setSuspensionDamping(float damping)
      Alter the suspension damping when expanded (native field: m_suspensionDamping).
      Parameters:
      damping - the desired damping (0→no damping, default=0.88)
    • setSuspensionStiffness

      public void setSuspensionStiffness(float stiffness)
      Alter the stiffness of the suspension (native field: m_suspensionStiffness).
      Parameters:
      stiffness - the desired stiffness constant (10→off-road buggy, 50→sports car, 200→Formula-1 race car, default=5.88)
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned tuning into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface com.jme3.util.clone.JmeCloneable
      Parameters:
      cloner - the Cloner that's cloning this tuning (unused)
      original - the instance from which this tuning was shallow-cloned (unused)
    • jmeClone

      public VehicleTuning jmeClone()
      Create a shallow clone for the JME cloner.
      Specified by:
      jmeClone in interface com.jme3.util.clone.JmeCloneable
      Returns:
      a new instance
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize these parameters from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize these parameters, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter