Interface ContactListener


public interface ContactListener

Notified when bodies in a PhysicsWorld start and stop touching. Register with PhysicsWorld#addContactListener(ContactListener).

Callbacks fire from inside PhysicsWorld#step(float) -- i.e. on the game loop thread -- so it is safe to read and update game state directly, but you must not create or destroy bodies during the callback (defer that until after step returns).

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called when two fixtures begin touching.
    void
    Called when two fixtures stop touching.
  • Method Details

    • beginContact

      void beginContact(PhysicsContact contact)
      Called when two fixtures begin touching.
    • endContact

      void endContact(PhysicsContact contact)
      Called when two fixtures stop touching.