From 2dd54dbfd000a28664d8c03ce46dc7ee41b0772f Mon Sep 17 00:00:00 2001 From: ejcoumans Date: Tue, 11 Sep 2007 21:18:45 +0000 Subject: [PATCH] only delete the BVH during re-scaling when we 'own' it. Thanks Phil Knight for reporting! --- src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp b/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp index 42530f2bf..cf3a7724a 100644 --- a/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp +++ b/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp @@ -177,7 +177,8 @@ void btBvhTriangleMeshShape::setLocalScaling(const btVector3& scaling) if ((getLocalScaling() -scaling).length2() > SIMD_EPSILON) { btTriangleMeshShape::setLocalScaling(scaling); - delete m_bvh; + if (m_ownsBvh) + delete m_bvh; ///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work m_bvh = new btOptimizedBvh(); //rebuild the bvh...