src/systems/CollisionDetectionSystem.cpp
bool CollisionDetectionSystem::computeNarrowPhaseCollisionSnapshot(NarrowPhaseInput& narrowPhaseInput, CollisionCallback& callback) {

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

    MemoryAllocator& allocator = mMemoryManager.getHeapAllocator();

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

    // If collision has been found, create contacts
    if (collisionFound) {

        Array<ContactPointInfo> potentialContactPoints(allocator);
        Array<ContactManifoldInfo> potentialContactManifolds(allocator);
        Array<ContactPair> contactPairs(allocator);
        Array<ContactPair> lostContactPairs(allocator);                  // Not used during collision snapshots
        Array<ContactManifold> contactManifolds(allocator);
        Array<ContactPoint> contactPoints(allocator);

        // Process all the potential contacts after narrow-phase collision
        processAllPotentialContacts(narrowPhaseInput, true, potentialContactPoints, potentialContactManifolds, &contactPairs);

        // Reduce the number of contact points in the manifolds
        reducePotentialContactManifolds(&contactPairs, potentialContactManifolds, potentialContactPoints);

        // Create the actual contact manifolds and contact points
        createSnapshotContacts(contactPairs, contactManifolds, contactPoints, potentialContactManifolds, potentialContactPoints);

        // Report the contacts to the user
        reportContacts(callback, &contactPairs, &contactManifolds, &contactPoints, lostContactPairs);
    }

    return collisionFound;
}
// Compute the narrow-phase collision detection for the testCollision() methods.
// This method returns true if contacts are found.
Compute the narrow-phase collision detection for the testCollision() methods.
This method returns true if contacts are found.
Compute the narrow - phase collision detection for the testCollision () methods . This method returns true if contacts are found .
bool CollisionDetectionSystem::computeNarrowPhaseCollisionSnapshot(NarrowPhaseInput& narrowPhaseInput, CollisionCallback& callback) {
    RP3D_PROFILE("CollisionDetectionSystem::computeNarrowPhaseCollisionSnapshot()", mProfiler);
    MemoryAllocator& allocator = mMemoryManager.getHeapAllocator();
    bool collisionFound = testNarrowPhaseCollision(narrowPhaseInput, false, allocator);
    if (collisionFound) {
        Array<ContactPointInfo> potentialContactPoints(allocator);
        Array<ContactManifoldInfo> potentialContactManifolds(allocator);
        Array<ContactPair> contactPairs(allocator);
        Array<ContactPair> lostContactPairs(allocator);                  
        Array<ContactManifold> contactManifolds(allocator);
        Array<ContactPoint> contactPoints(allocator);
        processAllPotentialContacts(narrowPhaseInput, true, potentialContactPoints, potentialContactManifolds, &contactPairs);
        reducePotentialContactManifolds(&contactPairs, potentialContactManifolds, potentialContactPoints);
        createSnapshotContacts(contactPairs, contactManifolds, contactPoints, potentialContactManifolds, potentialContactPoints);
        reportContacts(callback, &contactPairs, &contactManifolds, &contactPoints, lostContactPairs);
    }
    return collisionFound;
}
bool CollisionDetectionSystem :: computeNarrowPhaseCollisionSnapshot ( NarrowPhaseInput & narrowPhaseInput , CollisionCallback & callback ) { RP3D_PROFILE ( " " , mProfiler ) ; MemoryAllocator & allocator = mMemoryManager . getHeapAllocator ( ) ; bool collisionFound = testNarrowPhaseCollision ( narrowPhaseInput , false , allocator ) ; if ( collisionFound ) { Array < ContactPointInfo > potentialContactPoints ( allocator ) ; Array < ContactManifoldInfo > potentialContactManifolds ( allocator ) ; Array < ContactPair > contactPairs ( allocator ) ; Array < ContactPair > lostContactPairs ( allocator ) ; Array < ContactManifold > contactManifolds ( allocator ) ; Array < ContactPoint > contactPoints ( allocator ) ; processAllPotentialContacts ( narrowPhaseInput , true , potentialContactPoints , potentialContactManifolds , & contactPairs ) ; reducePotentialContactManifolds ( & contactPairs , potentialContactManifolds , potentialContactPoints ) ; createSnapshotContacts ( contactPairs , contactManifolds , contactPoints , potentialContactManifolds , potentialContactPoints ) ; reportContacts ( callback , & contactPairs , & contactManifolds , & contactPoints , lostContactPairs ) ; } return collisionFound ; }
Compute the narrow-phase collision detection for the testCollision() methods.
Compute the narrow - phase collision detection for the testCollision () methods .
// Test the narrow-phase collision detection on the batches to be tested // If collision has been found, create contacts // Not used during collision snapshots // Process all the potential contacts after narrow-phase collision // Reduce the number of contact points in the manifolds // Create the actual contact manifolds and contact points // Report the contacts to the user