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<JoltPhysicsObject>
A
CompoundShape
whose sub-shapes can be modified after the shape is
constructed.-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate an empty compound shape with no sub-shapes. -
Method Summary
Modifier and TypeMethodDescriptionint
addShape
(Vec3Arg offset, QuatArg rotation, ConstShape subshape) Add a sub-shape in the specified position.void
Recalculate the center of mass and shift the sub-shapes accordingly.void
modifyShapes
(int startIndex, int numSubshapes, ByteBuffer offsets, ByteBuffer rotations, int offsetStride, int rotationStride) Reposition multiple sub-shapes.void
removeShape
(int index) Remove the specified sub-shape.Methods inherited from class com.github.stephengold.joltjni.CompoundShape
getNumSubShapes, getSubShape, getSubShapes, restoreSubShapeState
Methods inherited from class com.github.stephengold.joltjni.Shape
copyDebugTriangles, countDebugTriangles, draw, drawGetSupportFunction, getCenterOfMass, getInnerRadius, getLeafShape, getLocalBounds, getMassProperties, getMaterial, getRefCount, getRevisionCount, getStats, getSubShapeIdBitsRecursive, getSubType, getType, getWorldSpaceBounds, getWorldSpaceBounds, isValidScale, makeScaleValid, mustBeStatic, saveBinaryState, setEmbedded, sRestoreFromBinaryState, toRef, toRefC
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
MutableCompoundShape
public MutableCompoundShape()Instantiate an empty compound shape with no sub-shapes.
-
-
Method Details
-
addShape
Add a sub-shape in the specified position.- Parameters:
offset
- the desired offset (not null, unaffected)rotation
- the desired rotation (not null, not zero, unaffected)subshape
- the desired sub-shape (not null)- Returns:
- the index of the added sub-shape
-
adjustCenterOfMass
public void adjustCenterOfMass()Recalculate the center of mass and shift the sub-shapes accordingly. -
modifyShapes
public void modifyShapes(int startIndex, int numSubshapes, ByteBuffer offsets, ByteBuffer rotations, int offsetStride, int rotationStride) Reposition multiple sub-shapes.- Parameters:
startIndex
- index of the first shape to reposition (≥0)numSubshapes
- the number of sub-shapes to reposition (≥0)offsets
- the desired offsets (not null, unaffected, length≥numSubShapes)rotations
- the desired rotations (not null, unaffected, length≥numSubShapes)offsetStride
- the number of bytes between the starting positions of sequential offsets (>0)rotationStride
- the number of bytes between the starting positions of sequential rotations (>0)
-
removeShape
public void removeShape(int index) Remove the specified sub-shape.- Parameters:
index
- the index (not the ID) of the sub-shape to remove (≥0)
-