Add getContactsList() method to DynamicsWorld
This commit is contained in:
parent
2a3fe8f8d1
commit
a4e28ddcf1
|
@ -952,3 +952,23 @@ void DynamicsWorld::testCollision(CollisionCallback* callback) {
|
||||||
// Perform the collision detection and report contacts
|
// Perform the collision detection and report contacts
|
||||||
mCollisionDetection.reportCollisionBetweenShapes(callback, emptySet, emptySet);
|
mCollisionDetection.reportCollisionBetweenShapes(callback, emptySet, emptySet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the list of all contacts of the world
|
||||||
|
std::vector<const ContactManifold*> DynamicsWorld::getContactsList() const {
|
||||||
|
|
||||||
|
std::vector<const ContactManifold*> contactManifolds;
|
||||||
|
|
||||||
|
// For each currently overlapping pair of bodies
|
||||||
|
std::map<overlappingpairid, OverlappingPair*>::const_iterator it;
|
||||||
|
for (it = mCollisionDetection.mOverlappingPairs.begin();
|
||||||
|
it != mCollisionDetection.mOverlappingPairs.end(); ++it) {
|
||||||
|
|
||||||
|
OverlappingPair* pair = it->second;
|
||||||
|
|
||||||
|
// Get the contact manifold
|
||||||
|
contactManifolds.push_back(pair->getContactManifold());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return all the contact manifold
|
||||||
|
return contactManifolds;
|
||||||
|
}
|
||||||
|
|
|
@ -297,6 +297,9 @@ class DynamicsWorld : public CollisionWorld {
|
||||||
/// Test and report collisions between all shapes of the world
|
/// Test and report collisions between all shapes of the world
|
||||||
virtual void testCollision(CollisionCallback* callback);
|
virtual void testCollision(CollisionCallback* callback);
|
||||||
|
|
||||||
|
/// Return the list of all contacts of the world
|
||||||
|
std::vector<const ContactManifold*> getContactsList() const;
|
||||||
|
|
||||||
// -------------------- Friendship -------------------- //
|
// -------------------- Friendship -------------------- //
|
||||||
|
|
||||||
friend class RigidBody;
|
friend class RigidBody;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user