MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / computeNarrowPhase

Method computeNarrowPhase

src/systems/CollisionDetectionSystem.cpp:691–718  ·  view source on GitHub ↗

Compute the narrow-phase collision detection

Source from the content-addressed store, hash-verified

689
690// Compute the narrow-phase collision detection
691void CollisionDetectionSystem::computeNarrowPhase() {
692
693 RP3D_PROFILE("CollisionDetectionSystem::computeNarrowPhase()", mProfiler);
694
695 MemoryAllocator& allocator = mMemoryManager.getSingleFrameAllocator();
696
697 // Swap the previous and current contacts arrays
698 swapPreviousAndCurrentContacts();
699
700 mPotentialContactManifolds.reserve(mNbPreviousPotentialContactManifolds);
701 mPotentialContactPoints.reserve(mNbPreviousPotentialContactPoints);
702
703 // Test the narrow-phase collision detection on the batches to be tested
704 testNarrowPhaseCollision(mNarrowPhaseInput, true, allocator);
705
706 // Process all the potential contacts after narrow-phase collision
707 processAllPotentialContacts(mNarrowPhaseInput, true, mPotentialContactPoints,
708 mPotentialContactManifolds, mCurrentContactPairs);
709
710 // Reduce the number of contact points in the manifolds
711 reducePotentialContactManifolds(mCurrentContactPairs, mPotentialContactManifolds, mPotentialContactPoints);
712
713 // Add the contact pairs to the bodies
714 addContactPairsToBodies();
715
716 assert(mCurrentContactManifolds->size() == 0);
717 assert(mCurrentContactPoints->size() == 0);
718}
719
720// Add the contact pairs to the corresponding bodies
721void CollisionDetectionSystem::addContactPairsToBodies() {

Callers

nothing calls this directly

Calls 2

reserveMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected