mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Fixing trimesh precision
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "bullet_utilities.h"
|
||||
#include "shape_owner_bullet.h"
|
||||
|
||||
#include <BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
|
||||
#include <BulletCollision/CollisionShapes/btConvexPointCloudShape.h>
|
||||
#include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
|
||||
#include <btBulletCollisionCommon.h>
|
||||
@@ -358,7 +359,8 @@ ConcavePolygonShapeBullet::ConcavePolygonShapeBullet() :
|
||||
ConcavePolygonShapeBullet::~ConcavePolygonShapeBullet() {
|
||||
if (meshShape) {
|
||||
delete meshShape->getMeshInterface();
|
||||
delete meshShape;
|
||||
delete meshShape->getTriangleInfoMap();
|
||||
bulletdelete(meshShape);
|
||||
}
|
||||
faces = PoolVector<Vector3>();
|
||||
}
|
||||
@@ -380,6 +382,7 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) {
|
||||
if (meshShape) {
|
||||
/// Clear previous created shape
|
||||
delete meshShape->getMeshInterface();
|
||||
delete meshShape->getTriangleInfoMap();
|
||||
bulletdelete(meshShape);
|
||||
}
|
||||
int src_face_count = faces.size();
|
||||
@@ -407,6 +410,8 @@ void ConcavePolygonShapeBullet::setup(PoolVector<Vector3> p_faces) {
|
||||
const bool useQuantizedAabbCompression = true;
|
||||
|
||||
meshShape = bulletnew(btBvhTriangleMeshShape(shapeInterface, useQuantizedAabbCompression));
|
||||
btTriangleInfoMap *triangleInfoMap = new btTriangleInfoMap();
|
||||
btGenerateInternalEdgeInfo(meshShape, triangleInfoMap);
|
||||
} else {
|
||||
meshShape = NULL;
|
||||
ERR_PRINT("The faces count are 0, the mesh shape cannot be created");
|
||||
|
||||
Reference in New Issue
Block a user