Package com.jme3.bullet
Class SoftBodyWorldInfo
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.SoftBodyWorldInfo
- All Implemented Interfaces:
com.jme3.export.Savable
,com.jme3.util.clone.JmeCloneable
,Cloneable
,Comparable<NativePhysicsObject>
public class SoftBodyWorldInfo
extends NativePhysicsObject
implements com.jme3.util.clone.JmeCloneable, com.jme3.export.Savable
Physics-simulation parameters that can be customized for each
PhysicsSoftBody, based on Bullet's
btSoftBodyWorldInfo
.
NOTE: When a PhysicsSoftBody is added to a PhysicsSoftSpace, it acquires the SoftBodyWorldInfo of that space. To customize a body, assign it a new info after adding it to the space.
-
Field Summary
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ConstructorDescriptionInstantiate an info that refers to a new btSoftBodyWorldInfo with the default parameters.SoftBodyWorldInfo
(long nativeId) Instantiate an info that refers to the identified native object. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the air density.void
cloneFields
(com.jme3.util.clone.Cloner cloner, Object original) Callback fromCloner
to convert this shallow-cloned info into a deep-cloned one, using the specified Cloner and original to resolve copied fields.void
copyAll
(SoftBodyWorldInfo source) Copy all parameter values from the specified info.com.jme3.math.Vector3f
copyGravity
(com.jme3.math.Vector3f storeResult) Copy the gravitational acceleration.com.jme3.math.Vector3f
copyWaterNormal
(com.jme3.math.Vector3f storeResult) Copy the normal direction of the water surface.jmeClone()
Create a shallow clone for the JME cloner.float
Return the maximum distance a node can travel in a simulation step.void
read
(com.jme3.export.JmeImporter importer) De-serialize this info from the specified importer, for example when loading from a J3O file.void
setAirDensity
(float density) Alter the air density.void
setGravity
(com.jme3.math.Vector3f acceleration) Alter the gravitational acceleration.void
setMaxDisplacement
(float maxDisplacement) Alter the maximum distance a node can travel per simulation step.void
setWaterDensity
(float density) Alter the water density.void
setWaterNormal
(com.jme3.math.Vector3f normalDirection) Alter the water normal.void
setWaterOffset
(float offset) Alter the water offset.float
Return the water density.float
Return the water offset.void
write
(com.jme3.export.JmeExporter exporter) Serialize this info to the specified exporter, 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
-
SoftBodyWorldInfo
public SoftBodyWorldInfo()Instantiate an info that refers to a new btSoftBodyWorldInfo with the default parameters. -
SoftBodyWorldInfo
public SoftBodyWorldInfo(long nativeId) Instantiate an info that refers to the identified native object. Used internally.- Parameters:
nativeId
- the ID of a pre-existing btSoftBodyWorldInfo (not zero)
-
-
Method Details
-
airDensity
public float airDensity()Return the air density.- Returns:
- the density
-
copyAll
Copy all parameter values from the specified info.- Parameters:
source
- the info to copy from (not null, unaffected)
-
copyGravity
public com.jme3.math.Vector3f copyGravity(com.jme3.math.Vector3f storeResult) Copy the gravitational acceleration.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- an acceleration vector in physics-space coordinates (either storeResult or a new vector, not null)
-
copyWaterNormal
public com.jme3.math.Vector3f copyWaterNormal(com.jme3.math.Vector3f storeResult) Copy the normal direction of the water surface.- Parameters:
storeResult
- storage for the result (modified if not null)- Returns:
- a direction vector (in physics-space coordinates, either storeResult or a new vector, not null)
-
maxDisplacement
public float maxDisplacement()Return the maximum distance a node can travel in a simulation step.- Returns:
- the distance (in physics-space units)
-
setAirDensity
public void setAirDensity(float density) Alter the air density.- Parameters:
density
- the desired density (default=1.2)
-
setGravity
public void setGravity(com.jme3.math.Vector3f acceleration) Alter the gravitational acceleration.- Parameters:
acceleration
- the desired acceleration vector (in physics-space coordinates, not null, unaffected, default=(0,-10,0))
-
setMaxDisplacement
public void setMaxDisplacement(float maxDisplacement) Alter the maximum distance a node can travel per simulation step.- Parameters:
maxDisplacement
- the desired value (>0, default=1000)
-
setWaterDensity
public void setWaterDensity(float density) Alter the water density.- Parameters:
density
- the desired density (default=0)
-
setWaterNormal
public void setWaterNormal(com.jme3.math.Vector3f normalDirection) Alter the water normal.- Parameters:
normalDirection
- the desired normal direction (not null, unaffected, default=(0,0,0))
-
setWaterOffset
public void setWaterOffset(float offset) Alter the water offset.- Parameters:
offset
- the desired offset distance (in physics-space units, default=0)
-
waterDensity
public float waterDensity()Return the water density.- Returns:
- the density
-
waterOffset
public float waterOffset()Return the water offset.- Returns:
- the offset distance (in physics-space units)
-
cloneFields
Callback fromCloner
to convert this shallow-cloned info 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 info (not null)original
- the instance from which this info was shallow-cloned (not null, unaffected)
-
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 this info 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 this info to the specified exporter, 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
-