Enable a convex overlapping pair
| 299 | |
| 300 | // Enable a convex overlapping pair |
| 301 | void OverlappingPairs::enableConvexPairWithIndex(uint64 pairIndex) { |
| 302 | |
| 303 | RP3D_PROFILE("OverlappingPairs::enableConvexPairWithIndex()", mProfiler); |
| 304 | |
| 305 | ConvexOverlappingPair* pair = &(mDisabledConvexPairs[static_cast<uint32>(pairIndex)]); |
| 306 | |
| 307 | assert(!pair->isEnabled); |
| 308 | |
| 309 | const uint64 newPairIndex = mConvexPairs.size(); |
| 310 | |
| 311 | // Map the entity with the new pair lookup index |
| 312 | mMapConvexPairIdToPairIndex.add(Pair<uint64, uint64>(pair->pairID, newPairIndex)); |
| 313 | |
| 314 | // Create a new pair to be added into the array of pairs |
| 315 | mConvexPairs.emplace(pair->pairID, pair->broadPhaseId1, pair->broadPhaseId2, pair->collider1, pair->collider2, |
| 316 | pair->narrowPhaseAlgorithmType, true); |
| 317 | mConvexPairs[newPairIndex].collidingInCurrentFrame = pair->collidingInCurrentFrame; |
| 318 | mConvexPairs[newPairIndex].collidingInPreviousFrame = pair->collidingInPreviousFrame; |
| 319 | |
| 320 | // Remove the previous overlapping pair from the convex array |
| 321 | removeDisabledConvexPairWithIndex(pairIndex, false); |
| 322 | } |
| 323 | |
| 324 | // Disable a convex overlapping pair (because both bodies of the pair are disabled) |
| 325 | void OverlappingPairs::disableConvexPairWithIndex(uint64 pairIndex) { |