Class MultiBodyCollider

All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable, Comparable<NativePhysicsObject>

public class MultiBodyCollider extends PhysicsCollisionObject
A collision object for a link or base in a MultiBody, based on Bullet's btMultiBodyLinkCollider.
  • Field Details

    • logger2

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

    • MultiBodyCollider

      protected MultiBodyCollider()
      No-argument constructor needed by SavableClassUtil.
    • MultiBodyCollider

      public MultiBodyCollider(MultiBody multiBody, int linkIndex)
      Instantiate a collider for the indexed link in the specified MultiBody. Used internally.
      Parameters:
      multiBody - (not null, alias created)
      linkIndex - the link index, or -1 for the base
  • Method Details

    • attachShape

      public void attachShape(CollisionShape shape)
      Attach the specified collision shape to this collider. Used internally.
      Parameters:
      shape - the shape to attach (not null, alias created)
    • getMultiBody

      public MultiBody getMultiBody()
      Access the MultiBody that contains this collider.
      Returns:
      the pre-existing instance (not null)
    • linkIndex

      public int linkIndex()
      Determine the index of the corresponding MultiBodyLink.
      Returns:
      the index (≥0) or -1 if this is the base collider
    • mass

      public float mass()
      Determine the mass of this collider.
      Returns:
      the mass (>0)
    • setPhysicsLocation

      public void setPhysicsLocation(com.jme3.math.Vector3f location)
      Directly alter the location of this collider's center.
      Parameters:
      location - the desired location (in physics-space coordinates, not null, finite, unaffected)
    • setPhysicsLocationDp

      public void setPhysicsLocationDp(com.simsilica.mathd.Vec3d location)
      Directly alter the location of this collider's center.
      Parameters:
      location - the desired location (in physics-space coordinates, not null, unaffected)
    • setPhysicsRotation

      public void setPhysicsRotation(com.jme3.math.Matrix3f orientation)
      Directly alter this collider's orientation.
      Parameters:
      orientation - the desired orientation (a rotation matrix in physics-space coordinates, not null, unaffected)
    • setPhysicsRotationDp

      public void setPhysicsRotationDp(com.simsilica.mathd.Matrix3d orientation)
      Directly alter this collider's orientation.
      Parameters:
      orientation - the desired orientation (a rotation matrix in physics-space coordinates, not null, unaffected)
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned object 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
      Overrides:
      cloneFields in class PhysicsCollisionObject
      Parameters:
      cloner - the Cloner that's cloning this object (not null)
      original - the instance from which this object was shallow-cloned (not null, unaffected)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this object from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class PhysicsCollisionObject
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this object to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class PhysicsCollisionObject
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter