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

Method testCollision

src/systems/CollisionDetectionSystem.cpp:1838–1858  ·  view source on GitHub ↗

Test collision and report contacts between two bodies.

Source from the content-addressed store, hash-verified

1836
1837// Test collision and report contacts between two bodies.
1838void CollisionDetectionSystem::testCollision(Body* body1, Body* body2, CollisionCallback& callback) {
1839
1840 NarrowPhaseInput narrowPhaseInput(mMemoryManager.getPoolAllocator(), mOverlappingPairs);
1841
1842 // Compute the broad-phase collision detection
1843 computeBroadPhase();
1844
1845 // Filter the overlapping pairs to get only the ones with the selected body involved
1846 Array<uint64> convexPairs(mMemoryManager.getPoolAllocator());
1847 Array<uint64> concavePairs(mMemoryManager.getPoolAllocator());
1848 filterOverlappingPairs(body1->getEntity(), body2->getEntity(), convexPairs, concavePairs);
1849
1850 if (convexPairs.size() > 0 || concavePairs.size() > 0) {
1851
1852 // Compute the middle-phase collision detection
1853 computeMiddlePhaseCollisionSnapshot(convexPairs, concavePairs, narrowPhaseInput, true);
1854
1855 // Compute the narrow-phase collision detection and report contacts
1856 computeNarrowPhaseCollisionSnapshot(narrowPhaseInput, callback);
1857 }
1858}
1859
1860// Test collision and report all the contacts involving the body in parameter
1861void CollisionDetectionSystem::testCollision(Body* body, CollisionCallback& callback) {

Calls 2

getEntityMethod · 0.45
sizeMethod · 0.45