Class CustomContactListener

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<ConstJoltPhysicsObject>

public abstract class CustomContactListener extends ContactListener
A customizable ContactListener.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate a customizable listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    onContactAdded(long body1va, long body2va, long manifoldVa, long settingsVa)
    Callback invoked (by native code) each time a new contact point is detected.
    abstract void
    onContactPersisted(long body1va, long body2va, long manifoldVa, long settingsVa)
    Callback invoked (by native code) each time a contact is detected that was also detected during the previous update.
    abstract void
    onContactRemoved(long pairVa)
    Callback invoked (by native code) each time a contact that was detected during the previous update is no longer detected.
    abstract int
    onContactValidate(long body1va, long body2va, double baseOffsetX, double baseOffsetY, double baseOffsetZ, long shapeVa)
    Callback invoked (by native code) after detecting collision between a pair of bodies, but before invoking onContactAdded() and before adding the contact constraint.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CustomContactListener

      public CustomContactListener()
      Instantiate a customizable listener.
  • Method Details

    • onContactAdded

      public abstract void onContactAdded(long body1va, long body2va, long manifoldVa, long settingsVa)
      Callback invoked (by native code) each time a new contact point is detected.
      Parameters:
      body1va - the virtual address of the first body in contact (not zero)
      body2va - the virtual address of the 2nd body in contact (not zero)
      manifoldVa - the virtual address of the contact manifold (not zero)
      settingsVa - the virtual address of the contact settings (not zero)
    • onContactPersisted

      public abstract void onContactPersisted(long body1va, long body2va, long manifoldVa, long settingsVa)
      Callback invoked (by native code) each time a contact is detected that was also detected during the previous update.
      Parameters:
      body1va - the virtual address of the first body in contact (not zero)
      body2va - the virtual address of the 2nd body in contact (not zero)
      manifoldVa - the virtual address of the contact manifold (not zero)
      settingsVa - the virtual address of the contact settings (not zero)
    • onContactRemoved

      public abstract void onContactRemoved(long pairVa)
      Callback invoked (by native code) each time a contact that was detected during the previous update is no longer detected.
      Parameters:
      pairVa - the virtual address of the SubShapeIDPair (not zero)
    • onContactValidate

      public abstract int onContactValidate(long body1va, long body2va, double baseOffsetX, double baseOffsetY, double baseOffsetZ, long shapeVa)
      Callback invoked (by native code) after detecting collision between a pair of bodies, but before invoking onContactAdded() and before adding the contact constraint.
      Parameters:
      body1va - the virtual address of the first body in contact (not zero)
      body2va - the virtual address of the 2nd body in contact (not zero)
      baseOffsetX - the X component of the base offset
      baseOffsetY - the Y component of the base offset
      baseOffsetZ - the Z component of the base offset
      shapeVa - the virtual address of the CollideShapeResult (not zero)
      Returns:
      how to the contact should be processed (an ordinal of ValidateResult)