Package com.github.stephengold.joltjni
Class Shape
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Shape
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstShape,RefTarget,AutoCloseable,Comparable<ConstJoltPhysicsObject>
- Direct Known Subclasses:
CompoundShape,ConvexShape,DecoratedShape,EmptyShape,HeightFieldShape,MeshShape,PlaneShape
The abstract base class for collision shapes.
-
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.Locate the shape's center of mass.floatReturn the radius of the largest sphere that fits inside the shape.Return a bounding box that includes the convex radius.Copy the shape's mass properties.intCount the active references to the nativeShape.Return the shape's subtype.getType()Return the shape's type.longReturn the shape's user data: can be used for anything.getWorldSpaceBounds(Mat44Arg comTransform, Vec3Arg scale) Return the bounding box including convex radius.booleanTest whether the shape can be used in a dynamic/kinematic body.voidMark the nativeShapeas embedded.voidsetUserData(long value) Alter the shape's user data.toRef()Create a counted reference to the nativeShape.toRefC()Create a counted reference to the nativeShape.Methods 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
-
Method Details
-
setUserData
public void setUserData(long value) Alter the shape's user data.- Parameters:
value- the desired value (default=0)
-
copyDebugTriangles
Copy the vertex coordinates of the shape's debug mesh to the specified buffer. The shape is unaffected.- Specified by:
copyDebugTrianglesin interfaceConstShape- Parameters:
storeBuffer- the buffer to fill with vertex coordinates (not null, modified)
-
countDebugTriangles
public int countDebugTriangles()Count the triangles in the shape's debug mesh. The shape is unaffected.- Specified by:
countDebugTrianglesin interfaceConstShape- Returns:
- the count (>0)
-
draw
public 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.- Specified by:
drawin interfaceConstShape- 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 ifuseMaterialColorsis 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
-
getCenterOfMass
Locate the shape's center of mass. The shape is unaffected.- Specified by:
getCenterOfMassin interfaceConstShape- Returns:
- a new location vector
-
getInnerRadius
public float getInnerRadius()Return the radius of the largest sphere that fits inside the shape. The shape is unaffected.- Specified by:
getInnerRadiusin interfaceConstShape- Returns:
- the radius (≥0)
-
getLocalBounds
Return a bounding box that includes the convex radius. The shape is unaffected.- Specified by:
getLocalBoundsin interfaceConstShape- Returns:
- a new, mutable box (relative to the shape's center of mass)
-
getMassProperties
Copy the shape's mass properties. The shape is unaffected.- Specified by:
getMassPropertiesin interfaceConstShape- Returns:
- a new, mutable properties object
-
getSubType
Return the shape's subtype. The shape is unaffected.- Specified by:
getSubTypein interfaceConstShape- Returns:
- an enum value (not null)
-
getType
Return the shape's type. The shape is unaffected.- Specified by:
getTypein interfaceConstShape- Returns:
- an enum value (not null)
-
getUserData
public long getUserData()Return the shape's user data: can be used for anything. The shape is unaffected.- Specified by:
getUserDatain interfaceConstShape- Returns:
- the value
-
getWorldSpaceBounds
Return the bounding box including convex radius. The shape is unaffected.- Specified by:
getWorldSpaceBoundsin interfaceConstShape- 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)
-
mustBeStatic
public boolean mustBeStatic()Test whether the shape can be used in a dynamic/kinematic body. The shape is unaffected.- Specified by:
mustBeStaticin interfaceConstShape- Returns:
- true if it can be only be static, otherwise false
-
toRefC
Create a counted reference to the nativeShape.- Specified by:
toRefCin interfaceConstShape- Returns:
- a new JVM object with a new native object assigned
-
getRefCount
public int getRefCount()Count the active references to the nativeShape. The shape is unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativeShapeas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativeShape.
-