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

Method testOverlap

src/systems/CollisionDetectionSystem.cpp:1775–1797  ·  view source on GitHub ↗

Return true if two bodies overlap (collide)

Source from the content-addressed store, hash-verified

1773
1774// Return true if two bodies overlap (collide)
1775bool CollisionDetectionSystem::testOverlap(Body* body1, Body* body2) {
1776
1777 NarrowPhaseInput narrowPhaseInput(mMemoryManager.getPoolAllocator(), mOverlappingPairs);
1778
1779 // Compute the broad-phase collision detection
1780 computeBroadPhase();
1781
1782 // Filter the overlapping pairs to get only the ones with the selected body involved
1783 Array<uint64> convexPairs(mMemoryManager.getPoolAllocator());
1784 Array<uint64> concavePairs(mMemoryManager.getPoolAllocator());
1785 filterOverlappingPairs(body1->getEntity(), body2->getEntity(), convexPairs, concavePairs);
1786
1787 if (convexPairs.size() > 0 || concavePairs.size() > 0) {
1788
1789 // Compute the middle-phase collision detection
1790 computeMiddlePhaseCollisionSnapshot(convexPairs, concavePairs, narrowPhaseInput, false);
1791
1792 // Compute the narrow-phase collision detection
1793 return computeNarrowPhaseOverlapSnapshot(narrowPhaseInput, nullptr);
1794 }
1795
1796 return false;
1797}
1798
1799// Report all the bodies that overlap (collide) in the world
1800void CollisionDetectionSystem::testOverlap(OverlapCallback& callback) {

Callers

nothing calls this directly

Calls 2

getEntityMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected