void ContactListener::EndContact(b2Contact *contact) { if (endContact != NULL) { endContact(contact); } }
void Box2DFixture::emitEndContact(Box2DFixture *other) { emit endContact(other); }
void ContactListener::handleEvent( core::objectmodel::Event* _event ) { if (simulation::CollisionBeginEvent::checkEventType(_event)) { mContactsVector.clear(); } else if (simulation::CollisionEndEvent::checkEventType(_event)) { const NarrowPhaseDetection::DetectionOutputMap& detectionOutputsMap = mNarrowPhase->getDetectionOutputs(); if ( detectionOutputsMap.size() == 0 ) { endContact(NULL); return; } //core::collision::NarrowPhaseDetection::DetectionOutputMap::iterator it = detectionOutputsMap.begin(); //const helper::vector<DetectionOutput>* detection = dynamic_cast<helper::vector<DetectionOutput>*>(it->second); //const TDetectionOutputVector<mCollisionModel1,mCollisionModel2>* detection = dynamic_cast<TDetectionOutputVector*>(it->second); if ( mCollisionModel2 == NULL ) { //// check only one collision model for (core::collision::NarrowPhaseDetection::DetectionOutputMap::const_iterator it = detectionOutputsMap.begin(); it!=detectionOutputsMap.end(); ++it ) { const CollisionModel* collMod1 = it->first.first; const CollisionModel* collMod2 = it->first.second; if ( mCollisionModel1 == collMod1 || mCollisionModel1 == collMod2 ) { if ( const helper::vector<DetectionOutput>* contacts = dynamic_cast<helper::vector<DetectionOutput>*>(it->second) ) { mContactsVector.push_back( contacts ); } } } } else { // check both collision models for (core::collision::NarrowPhaseDetection::DetectionOutputMap::const_iterator it = detectionOutputsMap.begin(); it!=detectionOutputsMap.end(); ++it ) { const CollisionModel* collMod1 = it->first.first; const CollisionModel* collMod2 = it->first.second; if ( (mCollisionModel1==collMod1 && mCollisionModel2==collMod2) || (mCollisionModel1==collMod2 && mCollisionModel2==collMod1) ) { if ( const helper::vector<DetectionOutput>* contacts = dynamic_cast<helper::vector<DetectionOutput>*>(it->second) ) { mContactsVector.push_back( contacts ); } } } } beginContact(mContactsVector); } }