1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-27 06:14:09 +00:00

Don't mess around with btEmptyShape. Use nullptr instead.

This commit is contained in:
unelsson 2023-03-28 23:54:26 +03:00
parent e19a3e07aa
commit 3d4da02b18

View File

@ -7,7 +7,6 @@
#include <osg/Transform>
#include <osg/TriangleFunctor>
#include <BulletCollision/CollisionShapes/btEmptyShape.h>
#include <BulletCollision/CollisionShapes/btTriangleMesh.h>
#include <components/misc/osguservalues.hpp>
@ -75,22 +74,9 @@ namespace Resource
osg::ref_ptr<BulletShape> getShape()
{
if (!mTriangleMesh)
if (!mTriangleMesh || mTriangleMesh->getNumTriangles() == 0)
return osg::ref_ptr<BulletShape>();
if (mTriangleMesh->getNumTriangles() == 0)
{
osg::ref_ptr<BulletShape> shape(new BulletShape);
mTriangleMesh.reset(nullptr);
auto emptyShape = std::make_unique<btEmptyShape>();
shape->mCollisionBox.mExtents[0] = 0.0f;
shape->mCollisionBox.mExtents[1] = 0.0f;
shape->mCollisionBox.mExtents[2] = 0.0f;
shape->mCollisionBox.mCenter = osg::Vec3f(0, 0, 0);
shape->mCollisionShape.reset(emptyShape.release());
return shape;
}
osg::ref_ptr<BulletShape> shape(new BulletShape);
auto triangleMeshShape = std::make_unique<TriangleMeshShape>(mTriangleMesh.release(), true);