src/systems/CollisionDetectionSystem.cpp
// Compute the lost contact pairs (contact pairs in contact in the previous frame but not in the current one)
Compute the lost contact pairs (contact pairs in contact in the previous frame but not in the current one)
Compute the lost contact pairs ( contact pairs in contact in the previous frame but not in the current one )
void CollisionDetectionSystem::computeLostContactPairs() {
    const uint32 nbConvexPairs = static_cast<uint32>(mOverlappingPairs.mConvexPairs.size());
    for (uint32 i=0; i < nbConvexPairs; i++) {
        if (mOverlappingPairs.mConvexPairs[i].collidingInPreviousFrame && !mOverlappingPairs.mConvexPairs[i].collidingInCurrentFrame) {
            if (mCollidersComponents.hasComponent(mOverlappingPairs.mConvexPairs[i].collider1) && mCollidersComponents.hasComponent(mOverlappingPairs.mConvexPairs[i].collider2)) {
                addLostContactPair(mOverlappingPairs.mConvexPairs[i]);
            }
        }
    }
    const uint32 nbConcavePairs = static_cast<uint32>(mOverlappingPairs.mConcavePairs.size());
    for (uint32 i=0; i < nbConcavePairs; i++) {
        if (mOverlappingPairs.mConcavePairs[i].collidingInPreviousFrame && !mOverlappingPairs.mConcavePairs[i].collidingInCurrentFrame) {
            if (mCollidersComponents.hasComponent(mOverlappingPairs.mConcavePairs[i].collider1) && mCollidersComponents.hasComponent(mOverlappingPairs.mConcavePairs[i].collider2)) {
                addLostContactPair(mOverlappingPairs.mConcavePairs[i]);
            }
        }
    }
}
void CollisionDetectionSystem :: computeLostContactPairs ( ) { const uint32 nbConvexPairs = static_cast < uint32 > ( mOverlappingPairs . mConvexPairs . size ( ) ) ; for ( uint32 i = 0 ; i < nbConvexPairs ; i ++ ) { if ( mOverlappingPairs . mConvexPairs [ i ] . collidingInPreviousFrame && ! mOverlappingPairs . mConvexPairs [ i ] . collidingInCurrentFrame ) { if ( mCollidersComponents . hasComponent ( mOverlappingPairs . mConvexPairs [ i ] . collider1 ) && mCollidersComponents . hasComponent ( mOverlappingPairs . mConvexPairs [ i ] . collider2 ) ) { addLostContactPair ( mOverlappingPairs . mConvexPairs [ i ] ) ; } } } const uint32 nbConcavePairs = static_cast < uint32 > ( mOverlappingPairs . mConcavePairs . size ( ) ) ; for ( uint32 i = 0 ; i < nbConcavePairs ; i ++ ) { if ( mOverlappingPairs . mConcavePairs [ i ] . collidingInPreviousFrame && ! mOverlappingPairs . mConcavePairs [ i ] . collidingInCurrentFrame ) { if ( mCollidersComponents . hasComponent ( mOverlappingPairs . mConcavePairs [ i ] . collider1 ) && mCollidersComponents . hasComponent ( mOverlappingPairs . mConcavePairs [ i ] . collider2 ) ) { addLostContactPair ( mOverlappingPairs . mConcavePairs [ i ] ) ; } } } }
Compute the lost contact pairs (contact pairs in contact in the previous frame but not in the current one)
Compute the lost contact pairs ( contact pairs in contact in the previous frame but not in the current one )
// For each convex pair // If the two colliders of the pair were colliding in the previous frame but not in the current one // If both bodies still exist // Create a lost contact pair // For each convex pair // If the two colliders of the pair were colliding in the previous frame but not in the current one // If both bodies still exist // Create a lost contact pair