Class MultiBodySpace

All Implemented Interfaces:
ContactListener, Comparable<NativePhysicsObject>
Direct Known Subclasses:
DeformableSpace

public class MultiBodySpace extends PhysicsSpace
A PhysicsSpace that supports multibodies, with its own btMultiBodyDynamicsWorld.
  • Field Details

    • logger2

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

    • MultiBodySpace

      public MultiBodySpace(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType)
      Instantiate a MultiBodySpace with a sequential-impulse solver. Must be invoked on the designated physics thread.
      Parameters:
      worldMin - the desired minimum coordinate values (not null, unaffected, default=(-10k,-10k,-10k))
      worldMax - the desired maximum coordinate values (not null, unaffected, default=(10k,10k,10k))
      broadphaseType - which broadphase accelerator to use (not null)
    • MultiBodySpace

      public MultiBodySpace(com.jme3.math.Vector3f worldMin, com.jme3.math.Vector3f worldMax, PhysicsSpace.BroadphaseType broadphaseType, SolverType solverType)
      Instantiate a MultiBodySpace 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

    • addMultiBody

      public void addMultiBody(MultiBody multiBody)
      Add the specified MultiBody and all its colliders.
      Parameters:
      multiBody - (not null)
    • countMultiBodies

      public int countMultiBodies()
      Count the multibodies in this space.
      Returns:
      the count (≥0)
    • getMultiBodyList

      public Collection<MultiBody> getMultiBodyList()
      Enumerate multibodies that have been added to this space and not yet removed.
      Returns:
      a new unmodifiable collection of pre-existing instances (not null)
    • getMultiBodySpace

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

      public void removeMultiBody(MultiBody multiBody)
      Remove the specified MultiBody and all its colliders.
      Parameters:
      multiBody - (not null)
    • activateAll

      public void activateAll(boolean forceFlag)
      Activate all colliders and rigid bodies in this space.
      Overrides:
      activateAll in class PhysicsSpace
      Parameters:
      forceFlag - true to force activation
    • add

      public void add(Object object)
      Add the specified object to this space.
      Overrides:
      add in class PhysicsSpace
      Parameters:
      object - the 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 PhysicsSpace
      Parameters:
      pco - the object to test (not null, unaffected)
      Returns:
      true if currently added, otherwise false
    • create

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

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

      public Collection<PhysicsCollisionObject> getPcoList()
      Enumerate collision objects that have been added to this space and not yet removed.
      Overrides:
      getPcoList in class PhysicsSpace
      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 PhysicsSpace
      Returns:
      true if empty, otherwise false
    • remove

      public void remove(Object object)
      Remove the specified object from this space.
      Overrides:
      remove in class PhysicsSpace
      Parameters:
      object - the object to remove, or null
    • updateSolver

      protected void updateSolver()
      Replace the existing contact-and-constraint solver with a new one of the correct type.
      Overrides:
      updateSolver in class PhysicsSpace