1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 21:49:56 +00:00
openmw-tes3mp/apps/openmw/mwphysics/contacttestwrapper.cpp

22 lines
803 B
C++
Raw Normal View History

#include <mutex>
#include "contacttestwrapper.h"
namespace MWPhysics
{
// Concurrent calls to contactPairTest (and by extension contactTest) are forbidden.
static std::mutex contactMutex;
void ContactTestWrapper::contactTest(btCollisionWorld* collisionWorld, btCollisionObject* colObj, btCollisionWorld::ContactResultCallback& resultCallback)
{
std::unique_lock lock(contactMutex);
collisionWorld->contactTest(colObj, resultCallback);
}
void ContactTestWrapper::contactPairTest(btCollisionWorld* collisionWorld, btCollisionObject* colObjA, btCollisionObject* colObjB, btCollisionWorld::ContactResultCallback& resultCallback)
{
std::unique_lock lock(contactMutex);
collisionWorld->contactPairTest(colObjA, colObjB, resultCallback);
}
}