src/systems/CollisionDetectionSystem.cpp
bool CollisionDetectionSystem::computeNarrowPhaseOverlapSnapshot(NarrowPhaseInput& narrowPhaseInput, OverlapCallback* callback) {

    RP3D_PROFILE("CollisionDetectionSystem::computeNarrowPhaseOverlapSnapshot()", mProfiler);

    MemoryAllocator& allocator = mMemoryManager.getPoolAllocator();

    // Test the narrow-phase collision detection on the batches to be tested
    bool collisionFound = testNarrowPhaseCollision(narrowPhaseInput, false, allocator);
    if (collisionFound && callback != nullptr) {

        // Compute the overlapping colliders
        Array<ContactPair> contactPairs(allocator);
        Array<ContactPair> lostContactPairs(allocator);          // Always empty in this case (snapshot)
        computeOverlapSnapshotContactPairs(narrowPhaseInput, contactPairs);

        // Report overlapping colliders
        OverlapCallback::CallbackData callbackData(contactPairs, lostContactPairs, false, *mWorld);
        (*callback).onOverlap(callbackData);
    }

    return collisionFound;
}
// Compute the narrow-phase collision detection for the testOverlap() methods.
/// This method returns true if contacts are found.
Compute the narrow-phase collision detection for the testOverlap() methods.
This method returns true if contacts are found.
Compute the narrow - phase collision detection for the testOverlap () methods . This method returns true if contacts are found .
bool CollisionDetectionSystem::computeNarrowPhaseOverlapSnapshot(NarrowPhaseInput& narrowPhaseInput, OverlapCallback* callback) {
    RP3D_PROFILE("CollisionDetectionSystem::computeNarrowPhaseOverlapSnapshot()", mProfiler);
    MemoryAllocator& allocator = mMemoryManager.getPoolAllocator();
    bool collisionFound = testNarrowPhaseCollision(narrowPhaseInput, false, allocator);
    if (collisionFound && callback != nullptr) {
        Array<ContactPair> contactPairs(allocator);
        Array<ContactPair> lostContactPairs(allocator);          
        computeOverlapSnapshotContactPairs(narrowPhaseInput, contactPairs);
        OverlapCallback::CallbackData callbackData(contactPairs, lostContactPairs, false, *mWorld);
        (*callback).onOverlap(callbackData);
    }
    return collisionFound;
}
bool CollisionDetectionSystem :: computeNarrowPhaseOverlapSnapshot ( NarrowPhaseInput & narrowPhaseInput , OverlapCallback * callback ) { RP3D_PROFILE ( " " , mProfiler ) ; MemoryAllocator & allocator = mMemoryManager . getPoolAllocator ( ) ; bool collisionFound = testNarrowPhaseCollision ( narrowPhaseInput , false , allocator ) ; if ( collisionFound && callback != nullptr ) { Array < ContactPair > contactPairs ( allocator ) ; Array < ContactPair > lostContactPairs ( allocator ) ; computeOverlapSnapshotContactPairs ( narrowPhaseInput , contactPairs ) ; OverlapCallback :: CallbackData callbackData ( contactPairs , lostContactPairs , false , * mWorld ) ; ( * callback ) . onOverlap ( callbackData ) ; } return collisionFound ; }
Compute the narrow-phase collision detection for the testOverlap() methods.
Compute the narrow - phase collision detection for the testOverlap () methods .
// Test the narrow-phase collision detection on the batches to be tested // Compute the overlapping colliders // Always empty in this case (snapshot) // Report overlapping colliders