Package com.deco2800.game.physics
Class PhysicsContactListener
java.lang.Object
com.deco2800.game.physics.PhysicsContactListener
- All Implemented Interfaces:
ContactListener
public class PhysicsContactListener extends java.lang.Object implements 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 PhysicsContactListener()
-
Method Summary
Modifier and Type Method Description void
beginContact(Contact contact)
void
endContact(Contact contact)
void
postSolve(Contact contact, ContactImpulse impulse)
void
preSolve(Contact contact, Manifold oldManifold)
-
Constructor Details
-
PhysicsContactListener
public PhysicsContactListener()
-
-
Method Details
-
beginContact
- Specified by:
beginContact
in interfaceContactListener
-
endContact
- Specified by:
endContact
in interfaceContactListener
-
preSolve
- Specified by:
preSolve
in interfaceContactListener
-
postSolve
- Specified by:
postSolve
in interfaceContactListener
-