Package com.csse3200.game.physics
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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)
-
Constructor Details
-
PhysicsContactListener
public PhysicsContactListener()
-
-
Method Details
-
beginContact
public void beginContact(com.badlogic.gdx.physics.box2d.Contact contact) - Specified by:
beginContact
in interfacecom.badlogic.gdx.physics.box2d.ContactListener
-
endContact
public void endContact(com.badlogic.gdx.physics.box2d.Contact contact) - Specified by:
endContact
in interfacecom.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 interfacecom.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 interfacecom.badlogic.gdx.physics.box2d.ContactListener
-