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 Details

    • logger

      public static final Logger 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

      public void copyAll(SoftBodyWorldInfo source)
      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

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner 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 interface com.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

      public SoftBodyWorldInfo 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 this info 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 this info to the specified exporter, 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