Asking Box2d if a collision happened
- by Rosarch
I'm using Box2dx (ported to C#; optimized for XNA). It handles collision resolution, but how can I tell if two objects are currently colliding?
This is the function I'm trying to write:
public bool IsColliding(GameObjectController collider1, GameObjectController collider2)
Where collider1.Model.Body is the Box2d Body, and collider1.Model.BodyDef is the Box2d BodyDef. (The same goes for collider2, of course.)
UPDATE: Looks like contact listeners or this could be useful:
AABB collisionBox;
model.Body.GetFixtureList().GetAABB(out collisionBox);
Why does GetFixtureList() return one fixture?