Class MutableCompoundShape

All Implemented Interfaces:
ConstJoltPhysicsObject, ConstShape, RefTarget, AutoCloseable, Comparable<ConstJoltPhysicsObject>

public class MutableCompoundShape extends CompoundShape
A CompoundShape whose subshapes can be modified after the shape is constructed.
  • Constructor Details

    • MutableCompoundShape

      public MutableCompoundShape()
      Instantiate an empty compound shape with no subshapes.
  • Method Details

    • addShape

      public int addShape(Vec3Arg offset, QuatArg rotation, ShapeRefC shapeRef)
      Add a subshape in the specified position.
      Parameters:
      offset - the desired offset (not null, unaffected)
      rotation - the desired rotation (not null, not zero, unaffected)
      shapeRef - a reference to the desired subshape (not null)
      Returns:
      the index of the added subshape
    • adjustCenterOfMass

      public void adjustCenterOfMass()
      Recalculate the center of mass and shift the subshapes accordingly.
    • removeShape

      public void removeShape(int index)
      Remove the specified subshape.
      Parameters:
      index - the index of the subshape to remove (≥0)