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 TypeMethodDescriptionintIdentify 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.floatReturn the distance to move shape 2 to resolve the collision.Access the colliding face on shape 1.Access the colliding face on shape 2.intIdentify the face on shape 1 where the collision occurred.intIdentify 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, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, 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
-
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:
getBodyId2in 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:
getContactPointOn1in 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:
getContactPointOn2in 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:
getPenetrationAxisin 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:
getPenetrationDepthin 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:
getSubShapeId1in interfaceConstCollideShapeResult- Returns:
- a
SubShapeIDvalue (typically negative)
-
getSubShapeId2
public int getSubShapeId2()Identify the sub-shape on shape 2 where the collision occurred. The object is unaffected. (native attribute: mSubShapeID2)- Specified by:
getSubShapeId2in interfaceConstCollideShapeResult- Returns:
- a
SubShapeIDvalue (typically negative)
-