Package com.github.stephengold.joltjni
Class CustomContactListener
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.ContactListener
com.github.stephengold.joltjni.CustomContactListener
- All Implemented Interfaces:
ConstJoltPhysicsObject,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A customizable
ContactListener.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidonContactAdded(long body1va, long body2va, long manifoldVa, long settingsVa) Callback invoked (by native code) each time a new contact point is detected.abstract voidonContactPersisted(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 voidonContactRemoved(long pairVa) Callback invoked (by native code) each time a contact that was detected during the previous update is no longer detected.abstract intonContactValidate(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 invokingonContactAdded()and before adding the contact constraint.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, va
-
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 theSubShapeIDPair(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 invokingonContactAdded()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 offsetbaseOffsetY- the Y component of the base offsetbaseOffsetZ- the Z component of the base offsetshapeVa- the virtual address of theCollideShapeResult(not zero)- Returns:
- how to the contact should be processed (an ordinal of
ValidateResult)
-