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

public class CollideShapeResult extends JoltPhysicsObject implements ConstCollideShapeResult
Information about a narrow-phase collision by a shape.
  • 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 interface ConstCollideShapeResult
      Returns:
      the BodyID value
    • getContactPointOn1

      public Vec3 getContactPointOn1()
      Copy the contact location on the surface of shape 1. The result object is unaffected. (native attribute: mContactPointOn1)
      Specified by:
      getContactPointOn1 in interface ConstCollideShapeResult
      Returns:
      a new location vector
    • getContactPointOn2

      public Vec3 getContactPointOn2()
      Copy the contact location on the surface of shape 2. The result object is unaffected. (native attribute: mContactPointOn2)
      Specified by:
      getContactPointOn2 in interface ConstCollideShapeResult
      Returns:
      a new location vector
    • getPenetrationAxis

      public Vec3 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 interface ConstCollideShapeResult
      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 interface ConstCollideShapeResult
      Returns:
      the signed distance
    • getShape1Face

      public CsrFace getShape1Face()
      Access the colliding face on shape 1. (native attribute: mShape1Face)
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getShape2Face

      public CsrFace 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 interface ConstCollideShapeResult
      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 interface ConstCollideShapeResult
      Returns:
      a SubShapeId value