Package com.jme3.bullet.objects.infos
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 Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cloneFields
(com.jme3.util.clone.Cloner cloner, Object original) Callback fromCloner
to convert this shallow-cloned tuning into a deep-cloned one, using the specified Cloner and original to resolve copied fields.float
Return the friction between tires and ground (native field: m_frictionSlip).float
Return the maximum force exerted by each wheel's suspension (native field: m_maxSuspensionForce).float
Determine the maximum travel distance for each wheel's suspension (native field: m_maxSuspensionTravelCm).float
Return the suspension damping when compressed (native field: m_suspensionCompression).float
Return the suspension damping when expanded (native field: m_suspensionDamping).float
Return the suspension stiffness (native field: m_suspensionStiffness).jmeClone()
Create a shallow clone for the JME cloner.void
read
(com.jme3.export.JmeImporter importer) De-serialize these parameters from the specified importer, for example when loading from a J3O file.void
setFrictionSlip
(float coeff) Alter the friction between tires and ground (native field: m_frictionSlip).void
setMaxSuspensionForce
(float maxForce) Alter the force exerted by each wheel's suspension (native field: m_maxSuspensionForce).void
setMaxSuspensionTravelCm
(float travelCm) Alter the maximum travel distance for the suspension (native field: m_maxSuspensionTravelCm).void
setSuspensionCompression
(float damping) Alter the suspension damping when compressed (native field: m_suspensionCompression).void
setSuspensionDamping
(float damping) Alter the suspension damping when expanded (native field: m_suspensionDamping).void
setSuspensionStiffness
(float stiffness) Alter the stiffness of the suspension (native field: m_suspensionStiffness).void
write
(com.jme3.export.JmeExporter exporter) Serialize these parameters, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeId, setNativeIdNotTracked, toString, unassignNativeObject
-
Field Details
-
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
Callback fromCloner
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 interfacecom.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
Create a shallow clone for the JME cloner.- Specified by:
jmeClone
in interfacecom.jme3.util.clone.JmeCloneable
- Returns:
- a new instance
-
read
De-serialize these parameters from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfacecom.jme3.export.Savable
- Parameters:
importer
- (not null)- Throws:
IOException
- from the importer
-
write
Serialize these parameters, for example when saving to a J3O file.- Specified by:
write
in interfacecom.jme3.export.Savable
- Parameters:
exporter
- (not null)- Throws:
IOException
- from the exporter
-