Class PhysicsContactListener

java.lang.Object
com.csse3200.game.physics.PhysicsContactListener
All Implemented Interfaces:
com.badlogic.gdx.physics.box2d.ContactListener

public class PhysicsContactListener extends Object implements com.badlogic.gdx.physics.box2d.ContactListener
Box2D collision events fire globally on the physics world, not per-object. The contact listener receives these events, finds the entities involved in the collision, and triggers events on them.

On contact start: evt = "collisionStart", params = (Fixture thisFixture, Fixture otherFixture)

On contact end: evt = "collisionEnd", params = (Fixture thisFixture, Fixture otherFixture)

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beginContact(com.badlogic.gdx.physics.box2d.Contact contact)
     
    void
    endContact(com.badlogic.gdx.physics.box2d.Contact contact)
     
    void
    postSolve(com.badlogic.gdx.physics.box2d.Contact contact, com.badlogic.gdx.physics.box2d.ContactImpulse impulse)
     
    void
    preSolve(com.badlogic.gdx.physics.box2d.Contact contact, com.badlogic.gdx.physics.box2d.Manifold oldManifold)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PhysicsContactListener

      public PhysicsContactListener()
  • Method Details

    • beginContact

      public void beginContact(com.badlogic.gdx.physics.box2d.Contact contact)
      Specified by:
      beginContact in interface com.badlogic.gdx.physics.box2d.ContactListener
    • endContact

      public void endContact(com.badlogic.gdx.physics.box2d.Contact contact)
      Specified by:
      endContact in interface com.badlogic.gdx.physics.box2d.ContactListener
    • preSolve

      public void preSolve(com.badlogic.gdx.physics.box2d.Contact contact, com.badlogic.gdx.physics.box2d.Manifold oldManifold)
      Specified by:
      preSolve in interface com.badlogic.gdx.physics.box2d.ContactListener
    • postSolve

      public void postSolve(com.badlogic.gdx.physics.box2d.Contact contact, com.badlogic.gdx.physics.box2d.ContactImpulse impulse)
      Specified by:
      postSolve in interface com.badlogic.gdx.physics.box2d.ContactListener