mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Compatibility with bullet versions < 2.81
This commit is contained in:
parent
cd42448cd6
commit
f511cb08ff
1 changed files with 22 additions and 6 deletions
|
@ -672,16 +672,24 @@ namespace MWPhysics
|
||||||
mLeastDistSqr(std::numeric_limits<float>::max())
|
mLeastDistSqr(std::numeric_limits<float>::max())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
#if BT_BULLET_VERSION >= 281
|
||||||
virtual btScalar addSingleResult(btManifoldPoint& cp,
|
virtual btScalar addSingleResult(btManifoldPoint& cp,
|
||||||
const btCollisionObjectWrapper* col0Wrap,int partId0,int index0,
|
const btCollisionObjectWrapper* col0Wrap,int partId0,int index0,
|
||||||
const btCollisionObjectWrapper* col1Wrap,int partId1,int index1)
|
const btCollisionObjectWrapper* col1Wrap,int partId1,int index1)
|
||||||
{
|
{
|
||||||
if (col1Wrap->m_collisionObject != mMe)
|
const btCollisionObject* collisionObject = col1Wrap->m_collisionObject;
|
||||||
|
#else
|
||||||
|
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* col0, int partId0, int index0,
|
||||||
|
const btCollisionObject* col1, int partId1, int index1)
|
||||||
|
{
|
||||||
|
const btCollisionObject* collisionObject = col1;
|
||||||
|
#endif
|
||||||
|
if (collisionObject != mMe)
|
||||||
{
|
{
|
||||||
btScalar distsqr = mOrigin.distance2(cp.getPositionWorldOnA());
|
btScalar distsqr = mOrigin.distance2(cp.getPositionWorldOnA());
|
||||||
if(!mObject || distsqr < mLeastDistSqr)
|
if(!mObject || distsqr < mLeastDistSqr)
|
||||||
{
|
{
|
||||||
mObject = col1Wrap->m_collisionObject;
|
mObject = collisionObject;
|
||||||
mLeastDistSqr = distsqr;
|
mLeastDistSqr = distsqr;
|
||||||
mContactPoint = cp.getPositionWorldOnA();
|
mContactPoint = cp.getPositionWorldOnA();
|
||||||
}
|
}
|
||||||
|
@ -874,11 +882,19 @@ namespace MWPhysics
|
||||||
public:
|
public:
|
||||||
std::vector<MWWorld::Ptr> mResult;
|
std::vector<MWWorld::Ptr> mResult;
|
||||||
|
|
||||||
virtual btScalar addSingleResult(btManifoldPoint& cp,
|
#if BT_BULLET_VERSION >= 281
|
||||||
const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,
|
virtual btScalar addSingleResult(btManifoldPoint& cp,
|
||||||
const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1)
|
const btCollisionObjectWrapper* col0Wrap,int partId0,int index0,
|
||||||
|
const btCollisionObjectWrapper* col1Wrap,int partId1,int index1)
|
||||||
{
|
{
|
||||||
const PtrHolder* holder = static_cast<const PtrHolder*>(colObj0Wrap->m_collisionObject->getUserPointer());
|
const btCollisionObject* collisionObject = col1Wrap->m_collisionObject;
|
||||||
|
#else
|
||||||
|
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* col0, int partId0, int index0,
|
||||||
|
const btCollisionObject* col1, int partId1, int index1)
|
||||||
|
{
|
||||||
|
const btCollisionObject* collisionObject = col1;
|
||||||
|
#endif
|
||||||
|
const PtrHolder* holder = static_cast<const PtrHolder*>(collisionObject->getUserPointer());
|
||||||
if (holder)
|
if (holder)
|
||||||
mResult.push_back(holder->getPtr());
|
mResult.push_back(holder->getPtr());
|
||||||
return 0.f;
|
return 0.f;
|
||||||
|
|
Loading…
Reference in a new issue