src/systems/CollisionDetectionSystem.cpp
bool CollisionDetectionSystem::testOverlap(CollisionBody* body1, CollisionBody* body2) {

    NarrowPhaseInput narrowPhaseInput(mMemoryManager.getPoolAllocator(), mOverlappingPairs);

    // Compute the broad-phase collision detection
    computeBroadPhase();

    // Filter the overlapping pairs to get only the ones with the selected body involved
    Array<uint64> convexPairs(mMemoryManager.getPoolAllocator());
    Array<uint64> concavePairs(mMemoryManager.getPoolAllocator());
    filterOverlappingPairs(body1->getEntity(), body2->getEntity(), convexPairs, concavePairs);

    if (convexPairs.size() > 0 || concavePairs.size() > 0) {

        // Compute the middle-phase collision detection
        computeMiddlePhaseCollisionSnapshot(convexPairs, concavePairs, narrowPhaseInput, false);

        // Compute the narrow-phase collision detection
        return computeNarrowPhaseOverlapSnapshot(narrowPhaseInput, nullptr);
    }

    return false;
}
// Return true if two bodies overlap (collide)
Return true if two bodies overlap (collide)
Return true if two bodies overlap ( collide )
bool CollisionDetectionSystem::testOverlap(CollisionBody* body1, CollisionBody* body2) {
    NarrowPhaseInput narrowPhaseInput(mMemoryManager.getPoolAllocator(), mOverlappingPairs);
    computeBroadPhase();
    Array<uint64> convexPairs(mMemoryManager.getPoolAllocator());
    Array<uint64> concavePairs(mMemoryManager.getPoolAllocator());
    filterOverlappingPairs(body1->getEntity(), body2->getEntity(), convexPairs, concavePairs);
    if (convexPairs.size() > 0 || concavePairs.size() > 0) {
        computeMiddlePhaseCollisionSnapshot(convexPairs, concavePairs, narrowPhaseInput, false);
        return computeNarrowPhaseOverlapSnapshot(narrowPhaseInput, nullptr);
    }
    return false;
}
bool CollisionDetectionSystem :: testOverlap ( CollisionBody * body1 , CollisionBody * body2 ) { NarrowPhaseInput narrowPhaseInput ( mMemoryManager . getPoolAllocator ( ) , mOverlappingPairs ) ; computeBroadPhase ( ) ; Array < uint64 > convexPairs ( mMemoryManager . getPoolAllocator ( ) ) ; Array < uint64 > concavePairs ( mMemoryManager . getPoolAllocator ( ) ) ; filterOverlappingPairs ( body1 -> getEntity ( ) , body2 -> getEntity ( ) , convexPairs , concavePairs ) ; if ( convexPairs . size ( ) > 0 || concavePairs . size ( ) > 0 ) { computeMiddlePhaseCollisionSnapshot ( convexPairs , concavePairs , narrowPhaseInput , false ) ; return computeNarrowPhaseOverlapSnapshot ( narrowPhaseInput , nullptr ) ; } return false ; }
Return true if two bodies overlap (collide)
Return true if two bodies overlap ( collide )
// Compute the broad-phase collision detection // Filter the overlapping pairs to get only the ones with the selected body involved // Compute the middle-phase collision detection // Compute the narrow-phase collision detection