Package com.github.stephengold.joltjni
Class MutableCompoundShape
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Shape
com.github.stephengold.joltjni.CompoundShape
com.github.stephengold.joltjni.MutableCompoundShape
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstShape,RefTarget,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A
CompoundShape whose subshapes can be modified after the shape is
constructed.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate an empty compound shape with no subshapes. -
Method Summary
Modifier and TypeMethodDescriptionintAdd a subshape in the specified position.voidRecalculate the center of mass and shift the subshapes accordingly.voidremoveShape(int index) Remove the specified subshape.Methods inherited from class com.github.stephengold.joltjni.CompoundShape
getNumSubShapes, getSubShapeMethods inherited from class com.github.stephengold.joltjni.Shape
copyDebugTriangles, countDebugTriangles, draw, getCenterOfMass, getInnerRadius, getLocalBounds, getMassProperties, getRefCount, getSubType, getType, getUserData, getWorldSpaceBounds, mustBeStatic, setEmbedded, setUserData, toRef, toRefCMethods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, va
-
Constructor Details
-
MutableCompoundShape
public MutableCompoundShape()Instantiate an empty compound shape with no subshapes.
-
-
Method Details
-
addShape
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)
-