Package com.jme3.bullet
Class DefaultContactManager
java.lang.Object
com.jme3.bullet.DefaultContactManager
- All Implemented Interfaces:
ContactListener,ContactManager
The default implementation of the ContactManager interface.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate a manager for the specified PhysicsSpace. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCollisionListener(PhysicsCollisionListener listener) Register the specified listener for new contacts.voidaddContactListener(ContactListener listener, boolean doEnded, boolean doProcessed, boolean doStarted) Register the specified listener for immediate contact notifications.voidRegister the specified listener for ongoing contacts.intCount how many collision listeners are registered.voidDistribute queued collision events to registered listeners.voidonContactEnded(long manifoldId) Invoked immediately after a contact manifold is destroyed.voidonContactProcessed(PhysicsCollisionObject pcoA, PhysicsCollisionObject pcoB, long pointId) Invoked immediately after a contact point is refreshed without being destroyed.voidonContactStarted(long manifoldId) Invoked immediately after a contact manifold is created.voidDe-register the specified listener for new contacts.voidremoveContactListener(ContactListener listener) De-register the specified listener for immediate contact notifications.voidDe-register the specified listener for ongoing contacts.voidupdate(float timeInterval, int maxSteps) Update the associated PhysicsSpace.
-
Constructor Details
-
DefaultContactManager
Instantiate a manager for the specified PhysicsSpace.- Parameters:
space- the PhysicsSpace whose notifications will be managed (not null, alias created)
-
-
Method Details
-
addCollisionListener
Register the specified listener for new contacts.During distributeEvents(), registered listeners are notified of all new contacts since the previous distributeEvents().
- Specified by:
addCollisionListenerin interfaceContactManager- Parameters:
listener- the listener to register (not null, alias created)
-
addContactListener
public void addContactListener(ContactListener listener, boolean doEnded, boolean doProcessed, boolean doStarted) Register the specified listener for immediate contact notifications.- Specified by:
addContactListenerin interfaceContactManager- Parameters:
listener- the listener to register (not null, alias created)doEnded- true to enableonContactEnded()callbacks for the listener, false to skip themdoProcessed- true to enableonContactProcessed()callbacks for the listener, false to skip themdoStarted- true to enableonContactStarted()callbacks for the listener, false to skip them
-
addOngoingCollisionListener
Register the specified listener for ongoing contacts.During distributeEvents(), registered listeners are notified of all ongoing contacts EXCEPT Sphere-Sphere contacts.
- Specified by:
addOngoingCollisionListenerin interfaceContactManager- Parameters:
listener- the listener to register (not null, alias created)
-
countCollisionListeners
public int countCollisionListeners()Count how many collision listeners are registered.- Specified by:
countCollisionListenersin interfaceContactManager- Returns:
- the count (≥0)
-
distributeEvents
public void distributeEvents()Distribute queued collision events to registered listeners.- Specified by:
distributeEventsin interfaceContactManager
-
removeCollisionListener
De-register the specified listener for new contacts.- Specified by:
removeCollisionListenerin interfaceContactManager- Parameters:
listener- the listener to de-register (not null)
-
removeContactListener
De-register the specified listener for immediate contact notifications.- Specified by:
removeContactListenerin interfaceContactManager- Parameters:
listener- the listener to de-register (not null)
-
removeOngoingCollisionListener
De-register the specified listener for ongoing contacts.- Specified by:
removeOngoingCollisionListenerin interfaceContactManager- Parameters:
listener- the listener to de-register (not null)
-
update
public void update(float timeInterval, int maxSteps) Update the associated PhysicsSpace. This method should be invoked from the thread that created the space.- Specified by:
updatein interfaceContactManager- Parameters:
timeInterval- the time interval to simulate (in seconds, ≥0)maxSteps- the maximum number of steps of sizeaccuracy(≥1) or 0 for a single step of sizetimeInterval
-
onContactEnded
public void onContactEnded(long manifoldId) Invoked immediately after a contact manifold is destroyed. Skipped if stepSimulation() was invoked with doEnded=false.- Specified by:
onContactEndedin interfaceContactListener- Parameters:
manifoldId- the native ID of thebtPersistentManifold(not zero)
-
onContactProcessed
public void onContactProcessed(PhysicsCollisionObject pcoA, PhysicsCollisionObject pcoB, long pointId) Invoked immediately after a contact point is refreshed without being destroyed. Skipped for Sphere-Sphere contacts. Skipped if stepSimulation() was invoked with doProcessed=false.- Specified by:
onContactProcessedin interfaceContactListener- Parameters:
pcoA- the first involved object (not null)pcoB- the 2nd involved object (not null)pointId- the native ID of thebtManifoldPoint(not zero)
-
onContactStarted
public void onContactStarted(long manifoldId) Invoked immediately after a contact manifold is created. Skipped if stepSimulation() was invoked with doStarted=false.- Specified by:
onContactStartedin interfaceContactListener- Parameters:
manifoldId- the native ID of thebtPersistentManifold(not zero)
-