Class DeformableSpace

All Implemented Interfaces:
ContactListener, Comparable<NativePhysicsObject>

public class DeformableSpace extends MultiBodySpace
A MultiBodySpace that supports deformables, with its own btDeformableMultiBodyDynamicsWorld.
  • Field Details

    • logger3

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

    • DeformableSpace

      public DeformableSpace(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType, SolverType solverType)
      Instantiate a DeformableSpace with the specified contact-and-constraint solver. Must be invoked on the designated physics thread.
      Parameters:
      worldMin - the desired minimum coordinate value for each axis (not null, unaffected, default=(-10k,-10k,-10k))
      worldMax - the desired maximum coordinate value for each axis (not null, unaffected, default=(10k,10k,10k))
      broadphaseType - which broadphase accelerator to use (not null)
      solverType - the desired constraint solver (not null)
  • Method Details

    • countSoftBodies

      public int countSoftBodies()
      Count the soft bodies in this space.
      Returns:
      the count (≥0)
    • getDeformableSpace

      public static DeformableSpace getDeformableSpace()
      Access the DeformableSpace running on this thread. For parallel physics, this may be invoked from the OpenGL thread.
      Returns:
      the pre-existing DeformableSpace running on this thread
    • getSoftBodyList

      public Collection<PhysicsSoftBody> getSoftBodyList()
      Enumerate soft bodies that have been added to this space and not yet removed.
      Returns:
      a new unmodifiable collection of pre-existing instances (not null)
    • getWorldInfo

      public SoftBodyWorldInfo getWorldInfo()
      Access the parameters applied when soft bodies are added to this space.
      Returns:
      the pre-existing instance (not null)
    • addCollisionObject

      public void addCollisionObject(PhysicsCollisionObject pco)
      Add the specified collision object to this space.
      Overrides:
      addCollisionObject in class PhysicsSpace
      Parameters:
      pco - the collision object to add (not null)
    • contains

      public boolean contains(PhysicsCollisionObject pco)
      Test whether the specified collision object is added to this space.
      Overrides:
      contains in class MultiBodySpace
      Parameters:
      pco - the object to test (not null, unaffected)
      Returns:
      true if currently added, otherwise false
    • countJoints

      public int countJoints()
      Count the joints in this space, including anchors and soft-body joints.
      Overrides:
      countJoints in class PhysicsSpace
      Returns:
      the count (≥0)
    • create

      protected void create()
      Must be invoked on the designated physics thread.
      Overrides:
      create in class MultiBodySpace
    • destroy

      public void destroy()
      Remove all collision objects and physics joints.
      Overrides:
      destroy in class MultiBodySpace
    • getPcoList

      public Collection<PhysicsCollisionObject> getPcoList()
      Enumerate collision objects that have been added to this space and not yet removed.
      Overrides:
      getPcoList in class MultiBodySpace
      Returns:
      a new modifiable collection of pre-existing instances (not null)
    • isEmpty

      public boolean isEmpty()
      Test whether this space is empty.
      Overrides:
      isEmpty in class MultiBodySpace
      Returns:
      true if empty, otherwise false
    • removeCollisionObject

      public void removeCollisionObject(PhysicsCollisionObject pco)
      Remove the specified collision object from this space.
      Overrides:
      removeCollisionObject in class PhysicsSpace
      Parameters:
      pco - the collision object to remove (not null)
    • setGravity

      public void setGravity(com.jme3.math.Vector3f gravity)
      Alter the gravitational acceleration acting on newly-added bodies.

      Typically, when a body is added to a space, the body's gravity gets set to that of the space. Thus, it is preferable to set the space's gravity before adding any bodies to the space.

      Overrides:
      setGravity in class PhysicsSpace
      Parameters:
      gravity - the desired acceleration vector (not null, unaffected, default=(0,-9.81,0))