Interface CollisionListener<T extends CollisionBody<E>,E extends Fixture>
-
- Type Parameters:
T
- theCollisionBody
typeE
- theFixture
type
- All Superinterfaces:
WorldEventListener
- All Known Implementing Classes:
CollisionListenerAdapter
public interface CollisionListener<T extends CollisionBody<E>,E extends Fixture> extends WorldEventListener
Interface to listen for collision events.Events for a pair of bodies (as long as they pass the criteria for the event to be called) will be called in the following order:
- Collision detected by the broadphase:
collision(BroadphaseCollisionData)
- Collision detected by the narrowphase:
collision(NarrowphaseCollisionData)
- Contact manifold created by the manifold solver:
collision(ManifoldCollisionData)
CollisionListener
s will still be notified of that event, but subsequent events will not occur (this indicates that you didn't want the collision to be resolved later).- Since:
- 1.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
collision(BroadphaseCollisionData<T,E> collision)
Called when twoFixture
s are colliding as determined by theBroadphaseDetector
.boolean
collision(ManifoldCollisionData<T,E> collision)
boolean
collision(NarrowphaseCollisionData<T,E> collision)
Called when twoFixture
s are colliding as determined by theNarrowphaseDetector
.
-
-
-
Method Detail
-
collision
boolean collision(BroadphaseCollisionData<T,E> collision)
Called when twoFixture
s are colliding as determined by theBroadphaseDetector
.CollisionBody
objects can have manyConvex
Shape
s that make up their geometry. Because of this, this method may be called multiple times if two multi-fixturedCollisionBody
s are colliding.This method is called when the two
Fixture
's expandedAABB
s are overlapping. Visually the bodies may not appear to be colliding (which is a valid case). If you need to make sure theCollisionBody
s are colliding, and not just their AABBs, use thecollision(NarrowphaseCollisionData)
method.Return false from this method to stop processing of this collision. Other
CollisionListener
s will still be notified of this event, however, no further collision or contact events will occur for this pair.The
collision(NarrowphaseCollisionData)
method is next in the sequence of collision events.- Parameters:
collision
- the broadphase collision data- Returns:
- boolean true if processing should continue for this collision
- Since:
- 3.2.0
-
collision
boolean collision(NarrowphaseCollisionData<T,E> collision)
Called when twoFixture
s are colliding as determined by theNarrowphaseDetector
.CollisionBody
objects can have manyConvex
Shape
s that make up their geometry. Because of this, this method may be called multiple times if two multi-fixturedCollisionBody
s are colliding.Return false from this method to stop processing of this collision. Other
CollisionListener
s will still be notified of this event, however, no further collision or contact events will occur for this pair.The
collision(ManifoldCollisionData)
method is next in the sequence of collision events.- Parameters:
collision
- the narrowphase collision data- Returns:
- boolean true if processing should continue for this collision
-
collision
boolean collision(ManifoldCollisionData<T,E> collision)
Called when twoFixture
s are colliding and a contactManifold
has been found.CollisionBody
objects can have manyConvex
Shape
s that make up their geometry. Because of this, this method may be called multiple times if two multi-fixturedCollisionBody
s are colliding.Modification of the
Manifold
object is allowed. TheManifold
is used to create contact constraints.Return false from this method to stop processing of this collision. Other
CollisionListener
s will still be notified of this event, however, no further collision or contact events will occur for this pair.- Parameters:
collision
- the manifold collision data- Returns:
- boolean true if processing should continue for this collision
-
-