Interface ContactManager

All Superinterfaces:
ContactListener
All Known Implementing Classes:
DefaultContactManager

public interface ContactManager extends ContactListener
Manage notifications when collision objects in a specific PhysicsSpace come into contact.
  • Method Details

    • addCollisionListener

      void addCollisionListener(PhysicsCollisionListener listener)
      Register the specified listener for new contacts.

      During distributeEvents(), registered listeners are notified of all new contacts since the previous distributeEvents().

      Parameters:
      listener - the listener to register (not null, alias created)
    • addContactListener

      void addContactListener(ContactListener listener, boolean doEnded, boolean doProcessed, boolean doStarted)
      Register the specified listener for immediate contact notifications.
      Parameters:
      listener - the listener to register (not null, alias created)
      doEnded - true to enable onContactEnded() callbacks for the listener, false to skip them
      doProcessed - true to enable onContactProcessed() callbacks for the listener, false to skip them
      doStarted - true to enable onContactStarted() callbacks for the listener, false to skip them
    • addOngoingCollisionListener

      void addOngoingCollisionListener(PhysicsCollisionListener listener)
      Register the specified listener for ongoing contacts.

      During distributeEvents(), registered listeners are notified of all ongoing contacts EXCEPT Sphere-Sphere contacts.

      Parameters:
      listener - the listener to register (not null, alias created)
    • countCollisionListeners

      int countCollisionListeners()
      Count how many collision listeners are registered.
      Returns:
      the count (≥0)
    • distributeEvents

      void distributeEvents()
      Distribute queued collision events to registered listeners.
    • removeCollisionListener

      void removeCollisionListener(PhysicsCollisionListener listener)
      De-register the specified listener for new contacts.
      Parameters:
      listener - the listener to de-register (not null)
    • removeContactListener

      void removeContactListener(ContactListener listener)
      De-register the specified listener for immediate contact notifications.
      Parameters:
      listener - the listener to de-register (not null)
    • removeOngoingCollisionListener

      void removeOngoingCollisionListener(PhysicsCollisionListener listener)
      De-register the specified listener for ongoing contacts.
      Parameters:
      listener - the listener to de-register (not null)
    • update

      void update(float timeInterval, int maxSteps)
      Update the associated PhysicsSpace. This method should be invoked from the thread that created the space.
      Parameters:
      timeInterval - the time interval to simulate (in seconds, ≥0)
      maxSteps - the maximum number of simulation steps of size accuracy (≥1) or 0 for a single simulation step of size timeInterval