I did not use box2d for Android, but I think the idea is there. You must implement contact handling methods. This is the way to do it in C ++.
class ContactListener : public b2ContactListener { public: ContactListener(); ~ContactListener(); void BeginContact(b2Contact *contact) {...} void EndContact(b2Contact *contact) {...} void PreSolve (b2Contact *contact, const b2Manifold *oldManifold) {...} void PostSolve (b2Contact *contact, const b2ContactImpulse *impulse) {...} };
Then just pass this class to `b2World '
source share