Package com.github.stephengold.joltjni
Class CollideShapeResult
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.CollideShapeResult
- All Implemented Interfaces:
ConstCollideShapeResult
,ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
- Direct Known Subclasses:
ShapeCastResult
Information about a narrow-phase collision by a shape.
-
Constructor Summary
ConstructorsConstructorDescriptionCollideShapeResult
(long shapeResultVa) Instantiate a shape result with the specified native object assigned but not owned. -
Method Summary
Modifier and TypeMethodDescriptionint
Identify the body to which shape 2 belongs.Copy the contact location on the surface of shape 1.Copy the contact location on the surface of shape 2.Copy the direction to move shape 2 out of collision along the shortest path.float
Return the distance to move shape 2 to resolve the collision.Access the colliding face on shape 1.Access the colliding face on shape 2.int
Identify the face on shape 1 where the collision occurred.int
Identify the sub-shape on shape 2 where the collision occurred.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
-
Constructor Details
-
CollideShapeResult
public CollideShapeResult(long shapeResultVa) Instantiate a shape result with the specified native object assigned but not owned.For use in custom collectors.
- Parameters:
shapeResultVa
- the virtual address of the native object to assign (not zero)
-
-
Method Details
-
getBodyId2
public int getBodyId2()Identify the body to which shape 2 belongs. The result object is unaffected. (native attribute: mBodyID2)- Specified by:
getBodyId2
in interfaceConstCollideShapeResult
- Returns:
- the BodyID value
-
getContactPointOn1
Copy the contact location on the surface of shape 1. The result object is unaffected. (native attribute: mContactPointOn1)- Specified by:
getContactPointOn1
in interfaceConstCollideShapeResult
- Returns:
- a new location vector
-
getContactPointOn2
Copy the contact location on the surface of shape 2. The result object is unaffected. (native attribute: mContactPointOn2)- Specified by:
getContactPointOn2
in interfaceConstCollideShapeResult
- Returns:
- a new location vector
-
getPenetrationAxis
Copy the direction to move shape 2 out of collision along the shortest path. The result object is unaffected. (native attribute: mPenetrationAxis)- Specified by:
getPenetrationAxis
in interfaceConstCollideShapeResult
- Returns:
- a new direction vector in system coordinates
-
getPenetrationDepth
public float getPenetrationDepth()Return the distance to move shape 2 to resolve the collision. The result object is unaffected. (native attribute: mPenetrationDepth)- Specified by:
getPenetrationDepth
in interfaceConstCollideShapeResult
- Returns:
- the signed distance
-
getShape1Face
Access the colliding face on shape 1. (native attribute: mShape1Face)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getShape2Face
Access the colliding face on shape 2. (native attribute: mShape2Face)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getSubShapeId1
public int getSubShapeId1()Identify the face on shape 1 where the collision occurred. The result is unaffected. (native attribute: mSubShapeID1)- Specified by:
getSubShapeId1
in interfaceConstCollideShapeResult
- Returns:
- a
SubShapeId
value
-
getSubShapeId2
public int getSubShapeId2()Identify the sub-shape on shape 2 where the collision occurred. The object is unaffected. (native attribute: mSubShapeID2)- Specified by:
getSubShapeId2
in interfaceConstCollideShapeResult
- Returns:
- a
SubShapeId
value
-