java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.TransformedShape
- All Implemented Interfaces:
ConstJoltPhysicsObject
,ConstTransformedShape
,AutoCloseable
,Comparable<JoltPhysicsObject>
A collision shape and a coordinate transform, typically extracted from a
Body
or Character
.-
Method Summary
Modifier and TypeMethodDescriptionboolean
castRay
(RRayCast raycast, RayCastResult storeResult) Cast a ray and find the closest hit.void
castRay
(RRayCast raycast, RayCastSettings settings, CastRayCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase ray and collect any hits.void
castShape
(RShapeCast shapeCast, ShapeCastSettings settings, RVec3Arg base, CastShapeCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase shape and collect any hits.void
collectTransformedShapes
(ConstAaBox box, TransformedShapeCollector collector, ShapeFilter shapeFilter) Collect transformed shapes for all leaf shapes of the current shape that collide with the specified bounding box.void
collidePoint
(RVec3Arg point, CollidePointCollector collector, ShapeFilter shapeFilter) Collect collisions with the specified point.void
collideShape
(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, CollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector) Collect collisions with the specified shape.void
collideShape
(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, CollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector, ShapeFilter shapeFilter) Collect collisions with the specified shape.void
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.Access the underlying coordinate transform.getShape()
Access the underlying collision shape.Copy the location of the center of mass.Copy the rotation of the shape.Copy the scale factors of the shape.void
getSupportingFace
(int subShapeId, Vec3Arg direction, RVec3Arg base, SupportingFace storeFace) Get the vertices of the face that provides support in the specified direction.int
getTrianglesNext
(GetTrianglesContext storeContext, int maxTriangles, FloatBuffer storeVertices) Collect triangles for debug visualization.void
getTrianglesStart
(GetTrianglesContext storeContext, ConstAaBox box, RVec3Arg base) Prepare to collect triangles in the specified box for debug visualization.Return the bounding box including convex radius.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
-
Method Details
-
castRay
Cast a ray and find the closest hit. The shape is unaffected.- Specified by:
castRay
in interfaceConstTransformedShape
- Parameters:
raycast
- the test ray (not null, unaffected)storeResult
- storage for the result (not null, modified)- Returns:
true
if a hit was found, otherwisefalse
-
castRay
public void castRay(RRayCast raycast, RayCastSettings settings, CastRayCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase ray and collect any hits. The shape is unaffected.- Specified by:
castRay
in interfaceConstTransformedShape
- Parameters:
raycast
- the test ray (not null, unaffected)settings
- the raycast configuration options to use (not null, unaffected)collector
- the hit collector to use (not null)shapeFilter
- the shape filter to apply (not null, unaffected)
-
castShape
public void castShape(RShapeCast shapeCast, ShapeCastSettings settings, RVec3Arg base, CastShapeCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase shape and collect any hits. The shape is unaffected.- Specified by:
castShape
in interfaceConstTransformedShape
- Parameters:
shapeCast
- the desired shape cast (not null, unaffected)settings
- the collision settings to use (not null, unaffected)base
- the base location for reporting hits (not null, unaffected, (0,0,0)→world coordinates)collector
- the hit collector to use (not null)shapeFilter
- the shape filter to apply (not null, unaffected)
-
collectTransformedShapes
public void collectTransformedShapes(ConstAaBox box, TransformedShapeCollector collector, ShapeFilter shapeFilter) Collect transformed shapes for all leaf shapes of the current shape that collide with the specified bounding box. The shape is unaffected.- Specified by:
collectTransformedShapes
in interfaceConstTransformedShape
- Parameters:
box
- the region of interest (in system coordinates)collector
- the hit collector to use (not null)shapeFilter
- the shape filter to apply (not null, unaffected)
-
collidePoint
Collect collisions with the specified point. The shape is unaffected.- Specified by:
collidePoint
in interfaceConstTransformedShape
- Parameters:
point
- the location of the point to test (not null, unaffected)collector
- the hit collector to use (not null)shapeFilter
- the shape filter to apply (not null, unaffected)
-
collideShape
public void collideShape(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, CollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector) Collect collisions with the specified shape. The shape is unaffected.- Specified by:
collideShape
in interfaceConstTransformedShape
- Parameters:
testShape
- the shape to test (not null, unaffected)shapeScale
- the scaling vector for the test shape (not null, unaffected)comTransform
- the coordinate transform to apply to the test shape's center of mass (not null, unaffected)settings
- the collision settings to use (not null, unaffected)base
- the base location for reporting hits (not null, unaffected, (0,0,0)→world coordinates)collector
- the hit collector to use (not null)
-
collideShape
public void collideShape(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, CollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector, ShapeFilter shapeFilter) Collect collisions with the specified shape. The shape is unaffected.- Specified by:
collideShape
in interfaceConstTransformedShape
- Parameters:
testShape
- the shape to test (not null, unaffected)shapeScale
- the scaling vector for the test shape (not null, unaffected)comTransform
- the coordinate transform to apply to the test shape's center of mass (not null, unaffected)settings
- the collision settings to use (not null, unaffected)base
- the base location for reporting hits (not null, unaffected, (0,0,0)→world coordinates)collector
- the hit collector to use (not null)shapeFilter
- the shape filter to apply (not null, unaffected)
-
copyDebugTriangles
Copy the vertex coordinates of the shape's debug mesh to the specified buffer. The shape is unaffected.- Specified by:
copyDebugTriangles
in interfaceConstTransformedShape
- 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:
countDebugTriangles
in interfaceConstTransformedShape
- Returns:
- the count (>0)
-
getCenterOfMassTransform
Access the underlying coordinate transform. The shape is unaffected.- Specified by:
getCenterOfMassTransform
in interfaceConstTransformedShape
- Returns:
- a new JVM object with the pre-existing native object assigned
-
getShape
Access the underlying collision shape. The shape is unaffected. (native member: mShape)- Specified by:
getShape
in interfaceConstTransformedShape
- Returns:
- a new JVM object with the pre-existing native object assigned
-
getShapePositionCom
Copy the location of the center of mass. The shape is unaffected. (native member: mShapePositionCOM)- Specified by:
getShapePositionCom
in interfaceConstTransformedShape
- Returns:
- a new object
-
getShapeRotation
Copy the rotation of the shape. The shape is unaffected. (native member: mShapeRotation)- Specified by:
getShapeRotation
in interfaceConstTransformedShape
- Returns:
- a new object
-
getShapeScale
Copy the scale factors of the shape. The shape is unaffected.- Specified by:
getShapeScale
in interfaceConstTransformedShape
- Returns:
- a new object
-
getSupportingFace
public void getSupportingFace(int subShapeId, Vec3Arg direction, RVec3Arg base, SupportingFace storeFace) Get the vertices of the face that provides support in the specified direction. The shape is unaffected.- Specified by:
getSupportingFace
in interfaceConstTransformedShape
- Parameters:
subShapeId
- which sub-shape to use (not null, unaffected)direction
- the test direction (in world coordinates, not null, unaffected)base
- the base location for reporting face vertices (not null, unaffected, (0,0,0)→world coordinates)storeFace
- storage for face vertices (not null)
-
getTrianglesNext
public int getTrianglesNext(GetTrianglesContext storeContext, int maxTriangles, FloatBuffer storeVertices) Collect triangles for debug visualization. The shape is unaffected.- Specified by:
getTrianglesNext
in interfaceConstTransformedShape
- Parameters:
storeContext
- storage for communication withgetTrianglesStart()
maxTriangles
- the maximum number of triangles to collectstoreVertices
- storage for triangle vertices- Returns:
- the number of triangles collected, or 0 if no more triangles are available
-
getTrianglesStart
Prepare to collect triangles in the specified box for debug visualization. The shape is unaffected.- Specified by:
getTrianglesStart
in interfaceConstTransformedShape
- Parameters:
storeContext
- storage for communication withgetTrianglesNext()
box
- the region of interest (in system coordinates, not null, unaffected)base
- the base location for reporting triangle vertices (not null, unaffected, (0,0,0)→world coordinates)
-
getWorldSpaceBounds
Return the bounding box including convex radius. The shape is unaffected.- Specified by:
getWorldSpaceBounds
in interfaceConstTransformedShape
- Returns:
- a new, mutable box (in system coordinates)
-