private void BuildOptimizedBvh()
 {
     if (m_ownsBvh)
     {
         m_bvh.Cleanup();
         m_bvh = null;
     }
     ///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work
     //void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16);
     m_bvh = new OptimizedBvh();
     //rebuild the bvh...
     m_bvh.Build(m_meshInterface, m_useQuantizedAabbCompression, ref m_localAabbMin, ref m_localAabbMax);
     m_ownsBvh = true;
 }
 private void BuildOptimizedBvh()
 {
     if (m_ownsBvh)
     {
         m_bvh.Cleanup();
         m_bvh = null;
     }
     ///m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work
     //void* mem = btAlignedAlloc(sizeof(btOptimizedBvh),16);
     m_bvh = new OptimizedBvh();
     //rebuild the bvh...
     m_bvh.Build(m_meshInterface, m_useQuantizedAabbCompression, ref m_localAabbMin, ref m_localAabbMax);
     m_ownsBvh = true;
 }
        ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
        public BvhTriangleMeshShape(StridingMeshInterface meshInterface, bool useQuantizedAabbCompression, ref IndexedVector3 bvhAabbMin, ref IndexedVector3 bvhAabbMax, bool buildBvh)
            : base(meshInterface)
        {
            m_bvh     = null;
            m_ownsBvh = false;
            m_useQuantizedAabbCompression = useQuantizedAabbCompression;
            m_shapeType = BroadphaseNativeTypes.TRIANGLE_MESH_SHAPE_PROXYTYPE;
#if !DISABLE_BVH
            if (buildBvh)
            {
                m_bvh = new OptimizedBvh();

                m_bvh.Build(meshInterface, m_useQuantizedAabbCompression, ref bvhAabbMin, ref bvhAabbMax);
                m_ownsBvh = true;
            }
#endif //DISABLE_BVH
        }
        ///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
        public BvhTriangleMeshShape(StridingMeshInterface meshInterface, bool useQuantizedAabbCompression, ref IndexedVector3 bvhAabbMin, ref IndexedVector3 bvhAabbMax, bool buildBvh)
            : base(meshInterface)
        {
            m_bvh = null;
            m_ownsBvh = false;
            m_useQuantizedAabbCompression = useQuantizedAabbCompression;
            m_shapeType = BroadphaseNativeTypes.TRIANGLE_MESH_SHAPE_PROXYTYPE;
#if !DISABLE_BVH

            if (buildBvh)
            {
                m_bvh = new OptimizedBvh();

                m_bvh.Build(meshInterface, m_useQuantizedAabbCompression, ref bvhAabbMin, ref bvhAabbMax);
                m_ownsBvh = true;
            }

#endif //DISABLE_BVH

        }