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 TypeMethodDescriptionbooleancastRay(RRayCast raycast, RayCastResult storeResult) Cast a ray and find the closest hit.voidcastRay(RRayCast raycast, ConstRayCastSettings settings, CastRayCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase ray and collect any hits.voidcastShape(RShapeCast shapeCast, ConstShapeCastSettings settings, RVec3Arg base, CastShapeCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase shape and collect any hits.voidcollectTransformedShapes(ConstAaBox box, TransformedShapeCollector collector, ShapeFilter shapeFilter) Collect transformed shapes for all leaf shapes of the current shape that collide with the specified bounding box.voidcollidePoint(RVec3Arg point, CollidePointCollector collector, ShapeFilter shapeFilter) Collect collisions with the specified point.voidcollideShape(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, ConstCollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector) Collect collisions with the specified shape.voidcollideShape(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, ConstCollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector, ShapeFilter shapeFilter) Collect collisions with the specified shape.voidcopyDebugTriangles(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.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.voidgetSupportingFace(int subShapeId, Vec3Arg direction, RVec3Arg base, SupportingFace storeFace) Get the vertices of the face that provides support in the specified direction.intgetTrianglesNext(GetTrianglesContext storeContext, int maxTriangles, FloatBuffer storeVertices) Collect triangles for debug visualization.voidgetTrianglesStart(GetTrianglesContext storeContext, ConstAaBox box, RVec3Arg base) Prepare to collect triangles in the specified box for debug visualization.Calculate a bounding box that includes scaling.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, targetVaOrZero, 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, targetVa, targetVaOrZero
-
Method Details
-
castRay
Cast a ray and find the closest hit. The shape is unaffected.- Specified by:
castRayin interfaceConstTransformedShape- Parameters:
raycast- the test ray (not null, unaffected)storeResult- storage for the result (not null, modified)- Returns:
trueif a hit was found, otherwisefalse
-
castRay
public void castRay(RRayCast raycast, ConstRayCastSettings settings, CastRayCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase ray and collect any hits. The shape is unaffected.- Specified by:
castRayin interfaceConstTransformedShape- Parameters:
raycast- the test ray (notnull, unaffected)settings- the raycast configuration options to use (notnull, unaffected)collector- the hit collector to use (notnull)shapeFilter- the shape filter to apply (notnull, unaffected)
-
castShape
public void castShape(RShapeCast shapeCast, ConstShapeCastSettings settings, RVec3Arg base, CastShapeCollector collector, ShapeFilter shapeFilter) Cast a narrow-phase shape and collect any hits. The shape is unaffected.- Specified by:
castShapein interfaceConstTransformedShape- Parameters:
shapeCast- the desired shape cast (notnull, unaffected)settings- the collision settings to use (notnull, unaffected)base- the base location for reporting hits (notnull, unaffected, (0,0,0)→world coordinates)collector- the hit collector to use (notnull)shapeFilter- the shape filter to apply (notnull, 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:
collectTransformedShapesin interfaceConstTransformedShape- Parameters:
box- the region of interest (in system coordinates)collector- the hit collector to use (notnull)shapeFilter- the shape filter to apply (notnull, unaffected)
-
collidePoint
Collect collisions with the specified point. The shape is unaffected.- Specified by:
collidePointin interfaceConstTransformedShape- Parameters:
point- the location of the point to test (notnull, unaffected)collector- the hit collector to use (notnull)shapeFilter- the shape filter to apply (notnull, unaffected)
-
collideShape
public void collideShape(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, ConstCollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector) Collect collisions with the specified shape. The shape is unaffected.- Specified by:
collideShapein interfaceConstTransformedShape- Parameters:
testShape- the shape to test (notnull, unaffected)shapeScale- the scaling vector for the test shape (notnull, unaffected)comTransform- the coordinate transform to apply to the test shape's center of mass (notnull, unaffected)settings- the collision settings to use (notnull, unaffected)base- the base location for reporting hits (notnull, unaffected, (0,0,0)→world coordinates)collector- the hit collector to use (notnull)
-
collideShape
public void collideShape(ConstShape testShape, Vec3Arg shapeScale, RMat44Arg comTransform, ConstCollideShapeSettings settings, RVec3Arg base, CollideShapeCollector collector, ShapeFilter shapeFilter) Collect collisions with the specified shape. The shape is unaffected.- Specified by:
collideShapein interfaceConstTransformedShape- Parameters:
testShape- the shape to test (notnull, unaffected)shapeScale- the scaling vector for the test shape (notnull, unaffected)comTransform- the coordinate transform to apply to the test shape's center of mass (notnull, unaffected)settings- the collision settings to use (notnull, unaffected)base- the base location for reporting hits (notnull, unaffected, (0,0,0)→world coordinates)collector- the hit collector to use (notnull)shapeFilter- the shape filter to apply (notnull, unaffected)
-
copyDebugTriangles
Copy the vertex coordinates of the shape's debug mesh to the specified buffer. The shape is unaffected.- Specified by:
copyDebugTrianglesin interfaceConstTransformedShape- Parameters:
storeBuffer- the buffer to fill with vertex coordinates (notnull, modified)
-
countDebugTriangles
public int countDebugTriangles()Count the triangles in the shape's debug mesh. The shape is unaffected.- Specified by:
countDebugTrianglesin interfaceConstTransformedShape- Returns:
- the count (>0)
-
getCenterOfMassTransform
Access the underlying coordinate transform. The shape is unaffected.- Specified by:
getCenterOfMassTransformin 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:
getShapein 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:
getShapePositionComin interfaceConstTransformedShape- Returns:
- a new object
-
getShapeRotation
Copy the rotation of the shape. The shape is unaffected. (native member: mShapeRotation)- Specified by:
getShapeRotationin interfaceConstTransformedShape- Returns:
- a new object
-
getShapeScale
Copy the scale factors of the shape. The shape is unaffected.- Specified by:
getShapeScalein 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:
getSupportingFacein interfaceConstTransformedShape- Parameters:
subShapeId- which sub-shape to use (notnull, unaffected)direction- the test direction (in world coordinates, notnull, unaffected)base- the base location for reporting face vertices (notnull, unaffected, (0,0,0)→world coordinates)storeFace- storage for face vertices (notnull)
-
getTrianglesNext
public int getTrianglesNext(GetTrianglesContext storeContext, int maxTriangles, FloatBuffer storeVertices) Collect triangles for debug visualization. The shape is unaffected.- Specified by:
getTrianglesNextin 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:
getTrianglesStartin interfaceConstTransformedShape- Parameters:
storeContext- storage for communication withgetTrianglesNext()box- the region of interest (in system coordinates, notnull, unaffected)base- the base location for reporting triangle vertices (notnull, unaffected, (0,0,0)→world coordinates)
-
getWorldSpaceBounds
Calculate a bounding box that includes scaling. The shape is unaffected.- Specified by:
getWorldSpaceBoundsin interfaceConstTransformedShape- Returns:
- a new, mutable box (in system coordinates)
-