Interface ConstShape
- All Superinterfaces:
AutoCloseable,Comparable<JoltPhysicsObject>,ConstJoltPhysicsObject
- All Known Subinterfaces:
ConstConvexShape
- All Known Implementing Classes:
BoxShape,CapsuleShape,CompoundShape,ConvexHullShape,ConvexShape,CylinderShape,DecoratedShape,EmptyShape,HeightFieldShape,MeshShape,MutableCompoundShape,OffsetCenterOfMassShape,PlaneShape,RotatedTranslatedShape,ScaledShape,Shape,ShapeRefC,SoftBodyShape,SphereShape,StaticCompoundShape,TaperedCapsuleShape,TaperedCylinderShape,TriangleShape
Read-only access to a
Shape. (native type: const Shape)-
Method Summary
Modifier and TypeMethodDescriptionvoidcopyDebugTriangles(FloatBuffer storeBuffer) Copy the vertex coordinates of the shape's debug mesh to the specified buffer.intCount the triangles in the shape's debug mesh.voiddraw(DebugRenderer renderer, RMat44Arg comTransform, Vec3Arg scale, ConstColor color, boolean useMaterialColors, boolean wireframe) Draw the shape using the specified renderer.voiddrawGetSupportFunction(DebugRenderer renderer, RMat44Arg comTransform, Vec3Arg scale, ConstColor color, boolean drawSupportDirection) Draw the support function with the convex radius added back on.Locate the shape's center of mass.floatReturn the radius of the largest sphere that fits inside the shape.getLeafShape(int subShapeId, int[] storeRemainderId) Access the leaf shape for the specified sub-shape ID.Return a bounding box that includes the convex radius.Copy the shape's mass properties.getMaterial(int subShapeId) Access the material of the specified sub-shape.intCount the active references to the nativeShape.longReturn the shape's revision count, which is automatically incremented each time the shape is altered.getStats()Copy the statistics.intCount how many bits are used to address leaf shapes.Return the shape's subtype.getType()Return the shape's type.getWorldSpaceBounds(Mat44Arg comTransform, Vec3Arg scale) Return the bounding box including convex radius.getWorldSpaceBounds(RMat44Arg comTransform, Vec3Arg scale) Return the bounding box including convex radius.booleanisValidScale(Vec3Arg scale) Test whether the specified scale vector is valid for wrapping the current shape in aScaledShape.makeScaleValid(Vec3Arg scale) Transform the specified scale vector such that it will be valid for wrapping the current shape in aScaledShape.booleanTest whether the shape can be used in a dynamic/kinematic body.voidsaveBinaryState(StreamOut stream) Save the shape to the specified binary stream.scaleShape(Vec3Arg scaleFactors) Scale the current shape, which is unaffected.toRefC()Create a read-only counted reference to the current shape.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
copyDebugTriangles
Copy the vertex coordinates of the shape's debug mesh to the specified buffer. The shape is unaffected.- Parameters:
storeBuffer- the buffer to fill with vertex coordinates (notnull, modified)
-
countDebugTriangles
int countDebugTriangles()Count the triangles in the shape's debug mesh. The shape is unaffected.- Returns:
- the count (>0)
-
draw
void draw(DebugRenderer renderer, RMat44Arg comTransform, Vec3Arg scale, ConstColor color, boolean useMaterialColors, boolean wireframe) Draw the shape using the specified renderer. The shape is unaffected.- Parameters:
renderer- the renderer to use (notnull)comTransform- the coordinate transform from the shape's center of mass to system coordinates (notnull, unaffected)scale- the desired scaling (notnull, unaffected)color- the desired color ifuseMaterialColorsis false (notnull, unaffected)useMaterialColors-trueto use the color in the shape's materialwireframe-trueto draw a wire frame,falsefor solid triangles
-
drawGetSupportFunction
void drawGetSupportFunction(DebugRenderer renderer, RMat44Arg comTransform, Vec3Arg scale, ConstColor color, boolean drawSupportDirection) Draw the support function with the convex radius added back on. The shape is unaffected.- Parameters:
renderer- the renderer to use (notnull)comTransform- transform to apply (notnull, unaffected)scale- scaling to apply (notnull, unaffected)color- the color using for drawing (notnull, unaffected)drawSupportDirection- the direction to draw
-
getCenterOfMass
Vec3 getCenterOfMass()Locate the shape's center of mass. The shape is unaffected.- Returns:
- a new location vector
-
getInnerRadius
float getInnerRadius()Return the radius of the largest sphere that fits inside the shape. The shape is unaffected.- Returns:
- the radius (≥0)
-
getLeafShape
Access the leaf shape for the specified sub-shape ID.- Parameters:
subShapeId- an ID that indicates the path to the desired leaf shape (notnull, unaffected)storeRemainderId- storage for the remainder of the sub-shape ID after removing the path to the leaf shape (notnull, length>0, modified)- Returns:
- a new JVM object with the pre-existing native object assigned, or
nullif the ID is invalid
-
getLocalBounds
AaBox getLocalBounds()Return a bounding box that includes the convex radius. The shape is unaffected.- Returns:
- a new, mutable box (relative to the shape's center of mass)
-
getMassProperties
MassProperties getMassProperties()Copy the shape's mass properties. The shape is unaffected.- Returns:
- a new, mutable properties object
-
getMaterial
Access the material of the specified sub-shape. The shape is unaffected.- Parameters:
subShapeId- which sub-shape- Returns:
- a new JVM object with the pre-existing native object assigned
-
getRefCount
int getRefCount()Count the active references to the nativeShape. The shape is unaffected.- Returns:
- the count (≥0)
-
getRevisionCount
long getRevisionCount()Return the shape's revision count, which is automatically incremented each time the shape is altered. The shape is unaffected.- Returns:
- the count
-
getStats
Stats getStats()Copy the statistics. The shape is unaffected.- Returns:
- a new object
-
getSubShapeIdBitsRecursive
int getSubShapeIdBitsRecursive()Count how many bits are used to address leaf shapes. The shape is unaffected.- Returns:
- the number of bits (≥0)
-
getSubType
EShapeSubType getSubType()Return the shape's subtype. The shape is unaffected.- Returns:
- an enum value (not
null)
-
getType
EShapeType getType()Return the shape's type. The shape is unaffected.- Returns:
- an enum value (not
null)
-
getWorldSpaceBounds
Return the bounding box including convex radius. The shape is unaffected.- Parameters:
comTransform- the center-of-mass transform to apply to the shape (notnull, unaffected)scale- the scale factors to apply to the shape (notnull, unaffected)- Returns:
- a new, mutable box (in system coordinates)
-
getWorldSpaceBounds
Return the bounding box including convex radius. The shape is unaffected.- Parameters:
comTransform- the center-of-mass transform to apply to the shape (notnull, unaffected)scale- the scale factors to apply to the shape (notnull, unaffected)- Returns:
- a new, mutable box (in system coordinates)
-
isValidScale
Test whether the specified scale vector is valid for wrapping the current shape in aScaledShape. The current shape is unaffected.- Parameters:
scale- the proposed scale vector (notnull, unaffected)- Returns:
trueif valid, otherwisefalse
-
makeScaleValid
Transform the specified scale vector such that it will be valid for wrapping the current shape in aScaledShape. The current shape is unaffected.- Parameters:
scale- the proposed scale vector (notnull, unaffected)- Returns:
- a new scale vector
-
mustBeStatic
boolean mustBeStatic()Test whether the shape can be used in a dynamic/kinematic body. The shape is unaffected.- Returns:
trueif it can be only be static, otherwisefalse
-
saveBinaryState
Save the shape to the specified binary stream. The shape is unaffected.- Parameters:
stream- the stream to write to (notnull)
-
scaleShape
Scale the current shape, which is unaffected.- Parameters:
scaleFactors- the desired scaling on each axis (notnull, unaffected)- Returns:
- a new JVM object with a new native object assigned
-
toRefC
ShapeRefC toRefC()Create a read-only counted reference to the current shape.- Returns:
- a new JVM object with a new native object assigned
-