Interface ConstShape
- All Superinterfaces:
Comparable<JoltPhysicsObject>
,ConstJoltPhysicsObject
- 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 TypeMethodDescriptionvoid
copyDebugTriangles
(FloatBuffer storeBuffer) Copy the vertex coordinates of the shape's debug mesh to the specified buffer.int
Count the triangles in the shape's debug mesh.void
draw
(DebugRenderer renderer, RMat44Arg comTransform, Vec3Arg scale, ConstColor color, boolean useMaterialColors, boolean wireframe) Draw the shape using the specified renderer.void
drawGetSupportFunction
(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.float
Return 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.long
Return the shape's revision count, which is automatically incremented each time the shape is altered.getStats()
Copy the statistics.int
Count 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.boolean
isValidScale
(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
.boolean
Test whether the shape can be used in a dynamic/kinematic body.void
saveBinaryState
(StreamOut stream) Save the shape to the specified binary stream.toRefC()
Create a counted reference to the nativeShape
.Methods inherited from interface java.lang.Comparable
compareTo
Methods 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 (not null, 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 (not null)comTransform
- the coordinate transform from the shape's center of mass to system coordinates (not null, unaffected)scale
- the desired scaling (not null, unaffected)color
- the desired color ifuseMaterialColors
is false (not null, unaffected)useMaterialColors
-true
to use the color in the shape's materialwireframe
-true
to draw a wire frame,false
for 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 (not null)comTransform
- transform to apply (not null, unaffected)scale
- scaling to apply (not null, unaffected)color
- the color using for drawing (not null, 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 (not null, unaffected)storeRemainderId
- storage for the remainder of the ID after removing the path to the leaf shape (not null, modified)- Returns:
- a new JVM object with the pre-existing native object assigned, or
null
if 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
-
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 (not null, unaffected)scale
- the scale factors to apply to the shape (not null, 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 (not null, unaffected)scale
- the scale factors to apply to the shape (not null, 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 (not null, unaffected)- Returns:
true
if 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 (not null, 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:
true
if 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 (not null)
-
toRefC
ShapeRefC toRefC()Create a counted reference to the nativeShape
.- Returns:
- a new JVM object with a new native object assigned
-