Class VehicleWheel

java.lang.Object
com.jme3.bullet.objects.VehicleWheel
All Implemented Interfaces:
Savable

public class VehicleWheel extends Object implements Savable
Stores info about one wheel of a PhysicsVehicle
  • Field Details Link icon

    • wheelInfo Link icon

      protected com.bulletphysics.dynamics.vehicle.WheelInfo wheelInfo
    • frontWheel Link icon

      protected boolean frontWheel
    • location Link icon

      protected Vector3f location
    • direction Link icon

      protected Vector3f direction
    • axle Link icon

      protected Vector3f axle
    • suspensionStiffness Link icon

      protected float suspensionStiffness
    • wheelsDampingRelaxation Link icon

      protected float wheelsDampingRelaxation
    • wheelsDampingCompression Link icon

      protected float wheelsDampingCompression
    • frictionSlip Link icon

      protected float frictionSlip
    • rollInfluence Link icon

      protected float rollInfluence
    • maxSuspensionTravelCm Link icon

      protected float maxSuspensionTravelCm
    • maxSuspensionForce Link icon

      protected float maxSuspensionForce
    • radius Link icon

      protected float radius
    • restLength Link icon

      protected float restLength
    • wheelWorldLocation Link icon

      protected Vector3f wheelWorldLocation
    • wheelWorldRotation Link icon

      protected Quaternion wheelWorldRotation
    • wheelSpatial Link icon

      protected Spatial wheelSpatial
    • tmp_Matrix Link icon

      protected Matrix3f tmp_Matrix
    • tmp_inverseWorldRotation Link icon

      protected final Quaternion tmp_inverseWorldRotation
  • Constructor Details Link icon

    • VehicleWheel Link icon

      protected VehicleWheel()
    • VehicleWheel Link icon

      public VehicleWheel(Spatial spat, Vector3f location, Vector3f direction, Vector3f axle, float restLength, float radius, boolean frontWheel)
    • VehicleWheel Link icon

      public VehicleWheel(Vector3f location, Vector3f direction, Vector3f axle, float restLength, float radius, boolean frontWheel)
  • Method Details Link icon

    • updatePhysicsState Link icon

      public void updatePhysicsState()
    • applyWheelTransform Link icon

      public void applyWheelTransform()
    • getWheelInfo Link icon

      public com.bulletphysics.dynamics.vehicle.WheelInfo getWheelInfo()
    • setWheelInfo Link icon

      public void setWheelInfo(com.bulletphysics.dynamics.vehicle.WheelInfo wheelInfo)
    • isFrontWheel Link icon

      public boolean isFrontWheel()
    • setFrontWheel Link icon

      public void setFrontWheel(boolean frontWheel)
    • getLocation Link icon

      public Vector3f getLocation()
    • getDirection Link icon

      public Vector3f getDirection()
    • getAxle Link icon

      public Vector3f getAxle()
    • getSuspensionStiffness Link icon

      public float getSuspensionStiffness()
    • setSuspensionStiffness Link icon

      public void setSuspensionStiffness(float suspensionStiffness)
      the stiffness constant for the suspension. 10.0 - Offroad buggy, 50.0 - Sports car, 200.0 - F1 Car
      Parameters:
      suspensionStiffness - the desired stiffness coefficient (10→off-road buggy, 50→sports car, 200→Formula-1 race car, default=20)
    • getWheelsDampingRelaxation Link icon

      public float getWheelsDampingRelaxation()
    • setWheelsDampingRelaxation Link icon

      public void setWheelsDampingRelaxation(float wheelsDampingRelaxation)
      the damping coefficient for when the suspension is expanding. See the comments for setWheelsDampingCompression for how to set k.
      Parameters:
      wheelsDampingRelaxation - the desired damping coefficient (default=2.3)
    • getWheelsDampingCompression Link icon

      public float getWheelsDampingCompression()
    • setWheelsDampingCompression Link icon

      public void setWheelsDampingCompression(float wheelsDampingCompression)
      the damping coefficient for when the suspension is compressed. Set to k * 2.0 * FastMath.sqrt(m_suspensionStiffness) so k is proportional to critical damping.
      k = 0.0 undamped/bouncy, k = 1.0 critical damping
      0.1 to 0.3 are good values
      Parameters:
      wheelsDampingCompression - the desired damping coefficient (default=4.4)
    • getFrictionSlip Link icon

      public float getFrictionSlip()
    • setFrictionSlip Link icon

      public void setFrictionSlip(float frictionSlip)
      the coefficient of friction between the tyre and the ground. Should be about 0.8 for realistic cars, but can be increased for better handling. Set large (10000.0) for kart racers
      Parameters:
      frictionSlip - the desired coefficient of friction between tyre and ground (0.8→realistic car, 10000→kart racer, default=10.5)
    • getRollInfluence Link icon

      public float getRollInfluence()
    • setRollInfluence Link icon

      public void setRollInfluence(float rollInfluence)
      reduces the rolling torque applied from the wheels that cause the vehicle to roll over. This is a bit of a hack, but it's quite effective. 0.0 = no roll, 1.0 = physical behaviour. If m_frictionSlip is too high, you'll need to reduce this to stop the vehicle rolling over. You should also try lowering the vehicle's centre of mass
      Parameters:
      rollInfluence - the rollInfluence to set
    • getMaxSuspensionTravelCm Link icon

      public float getMaxSuspensionTravelCm()
    • setMaxSuspensionTravelCm Link icon

      public void setMaxSuspensionTravelCm(float maxSuspensionTravelCm)
      the maximum distance the suspension can be compressed (centimetres)
      Parameters:
      maxSuspensionTravelCm - 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)
    • getMaxSuspensionForce Link icon

      public float getMaxSuspensionForce()
    • setMaxSuspensionForce Link icon

      public void setMaxSuspensionForce(float maxSuspensionForce)
      The maximum suspension force, raise this above the default 6000 if your suspension cannot handle the weight of your vehicle.
      Parameters:
      maxSuspensionForce - the desired maximum force per wheel (default=6000)
    • getRadius Link icon

      public float getRadius()
    • setRadius Link icon

      public void setRadius(float radius)
    • getRestLength Link icon

      public float getRestLength()
    • setRestLength Link icon

      public void setRestLength(float restLength)
    • getGroundObject Link icon

      public PhysicsCollisionObject getGroundObject()
      returns the object this wheel is in contact with or null if no contact
      Returns:
      the PhysicsCollisionObject (PhysicsRigidBody, PhysicsGhostObject)
    • getCollisionLocation Link icon

      public Vector3f getCollisionLocation(Vector3f vec)
      returns the location where the wheel collides with the ground (world space)
      Parameters:
      vec - storage for the result (not null, modified)
      Returns:
      a location vector (in physics-space coordinates)
    • getCollisionLocation Link icon

      public Vector3f getCollisionLocation()
      returns the location where the wheel collides with the ground (world space)
      Returns:
      a new location vector (in physics-space coordinates)
    • getCollisionNormal Link icon

      public Vector3f getCollisionNormal(Vector3f vec)
      returns the normal where the wheel collides with the ground (world space)
      Parameters:
      vec - storage for the result (not null, modified)
      Returns:
      a unit vector (in physics-space coordinates)
    • getCollisionNormal Link icon

      public Vector3f getCollisionNormal()
      returns the normal where the wheel collides with the ground (world space)
      Returns:
      a new unit vector (in physics-space coordinates)
    • getSkidInfo Link icon

      public float getSkidInfo()
      returns how much the wheel skids on the ground (for skid sounds/smoke etc.)
      0.0 = wheels are sliding, 1.0 = wheels have traction.
      Returns:
      the relative amount of traction (0→wheel is sliding, 1→wheel has full traction)
    • getDeltaRotation Link icon

      public float getDeltaRotation()
      returns how many degrees the wheel has turned since the last physics step.
      Returns:
      the rotation angle (in radians)
    • read Link icon

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException
    • write Link icon

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • getWheelSpatial Link icon

      public Spatial getWheelSpatial()
      Returns:
      the wheelSpatial
    • setWheelSpatial Link icon

      public void setWheelSpatial(Spatial wheelSpatial)
      Parameters:
      wheelSpatial - the wheelSpatial to set
    • isApplyLocal Link icon

      public boolean isApplyLocal()
    • setApplyLocal Link icon

      public void setApplyLocal(boolean applyLocal)
    • getWheelWorldRotation Link icon

      public void getWheelWorldRotation(Quaternion store)
      write the content of the wheelWorldRotation into the store
      Parameters:
      store - storage for the result (not null, modified)
    • getWheelWorldLocation Link icon

      public void getWheelWorldLocation(Vector3f store)
      write the content of the wheelWorldLocation into the store
      Parameters:
      store - storage for the result (not null, modified)