Raise the required bullet version to 2.83

2.82 appears to have a bug that causes the player to be able to phase through certain objects (bug #1587).
move
scrawl 8 years ago
parent dad38d901c
commit 83a9a164bc

@ -765,18 +765,11 @@ namespace MWPhysics
mLeastDistSqr(std::numeric_limits<float>::max())
{ }
#if BT_BULLET_VERSION >= 281
virtual btScalar addSingleResult(btManifoldPoint& cp,
const btCollisionObjectWrapper* col0Wrap,int partId0,int index0,
const btCollisionObjectWrapper* col1Wrap,int partId1,int index1)
{
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());
@ -1026,7 +1019,6 @@ namespace MWPhysics
std::vector<MWWorld::Ptr> mResult;
#if BT_BULLET_VERSION >= 281
virtual btScalar addSingleResult(btManifoldPoint& cp,
const btCollisionObjectWrapper* col0Wrap,int partId0,int index0,
const btCollisionObjectWrapper* col1Wrap,int partId1,int index1)
@ -1034,14 +1026,6 @@ namespace MWPhysics
const btCollisionObject* collisionObject = col0Wrap->m_collisionObject;
if (collisionObject == mTestedAgainst)
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 = col0;
if (collisionObject == mTestedAgainst)
collisionObject = col1;
#endif
PtrHolder* holder = static_cast<PtrHolder*>(collisionObject->getUserPointer());
if (holder)
mResult.push_back(holder->getPtr());

@ -65,21 +65,7 @@ btCollisionShape* BulletShape::duplicateCollisionShape(const btCollisionShape *s
if(const btBvhTriangleMeshShape* trishape = dynamic_cast<const btBvhTriangleMeshShape*>(shape))
{
#if BT_BULLET_VERSION >= 283
btScaledBvhTriangleMeshShape* newShape = new btScaledBvhTriangleMeshShape(const_cast<btBvhTriangleMeshShape*>(trishape), btVector3(1.f, 1.f, 1.f));
#else
// work around btScaledBvhTriangleMeshShape bug ( https://code.google.com/p/bullet/issues/detail?id=371 ) in older bullet versions
const btTriangleMesh* oldMesh = static_cast<const btTriangleMesh*>(trishape->getMeshInterface());
btTriangleMesh* newMesh = new btTriangleMesh(*oldMesh);
// Do not build a new bvh (not needed, since it's the same as the original shape's bvh)
btOptimizedBvh* bvh = const_cast<btBvhTriangleMeshShape*>(trishape)->getOptimizedBvh();
TriangleMeshShape* newShape = new TriangleMeshShape(newMesh, true, bvh == NULL);
// Set original shape's bvh via pointer
// The pointer is safe because the BulletShapeInstance keeps a ref_ptr to the original BulletShape
if (bvh)
newShape->setOptimizedBvh(bvh);
#endif
return newShape;
}

@ -6,9 +6,15 @@
#include <osg/ref_ptr>
#include <LinearMath/btScalar.h>
#include "bulletshape.hpp"
#include "resourcemanager.hpp"
#if BT_BULLET_VERSION < 283
#error "OpenMW requires Bullet version 2.83 or later"
#endif
namespace Resource
{
class SceneManager;

Loading…
Cancel
Save