CollisionCallbackData Constructor
| 68 | |
| 69 | // CollisionCallbackData Constructor |
| 70 | OverlapCallback::CallbackData::CallbackData(Array<ContactPair>& contactPairs, Array<ContactPair>& lostContactPairs, bool onlyReportTriggers, PhysicsWorld& world) |
| 71 | :mContactPairs(contactPairs), mLostContactPairs(lostContactPairs), |
| 72 | mContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mLostContactPairsIndices(world.mMemoryManager.getHeapAllocator()), mWorld(world) { |
| 73 | |
| 74 | // Filter the contact pairs to only keep the overlap/trigger events (not the contact events) |
| 75 | const uint64 nbContactPairs = mContactPairs.size(); |
| 76 | for (uint64 i=0; i < nbContactPairs; i++) { |
| 77 | |
| 78 | // If the contact pair contains contacts (and is therefore not an overlap/trigger event) |
| 79 | if (!onlyReportTriggers || mContactPairs[i].isTrigger) { |
| 80 | mContactPairsIndices.add(i); |
| 81 | } |
| 82 | } |
| 83 | // Filter the lost contact pairs to only keep the overlap/trigger events (not the contact events) |
| 84 | const uint64 nbLostContactPairs = mLostContactPairs.size(); |
| 85 | for (uint64 i=0; i < nbLostContactPairs; i++) { |
| 86 | |
| 87 | // If the contact pair contains contacts (and is therefore not an overlap/trigger event) |
| 88 | if (!onlyReportTriggers || mLostContactPairs[i].isTrigger) { |
| 89 | mLostContactPairsIndices.add(i); |
| 90 | } |
| 91 | } |
| 92 | } |