summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-16 10:38:31 +0200
committerGitHub <noreply@github.com>2019-05-16 10:38:31 +0200
commit4a2506508993cf5918736d321c3a53ebcdbcd635 (patch)
treeb4d9a0ace5bbd666f0ffd5bee9c8b18d27fd7b71 /modules
parenteded8d52e3f11357451214ab4d957ed1f7a31b18 (diff)
parentc38d9180df3763dbb6b13af45fcc07b8bddc5819 (diff)
Merge pull request #28928 from godotengine/revert-28328-revert-25543-optimize_bullet_heightfield_raycast2
Revert "Revert "Implemented terrain raycast acceleration""
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/shape_bullet.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp
index b590d63167..f15bcec914 100644
--- a/modules/bullet/shape_bullet.cpp
+++ b/modules/bullet/shape_bullet.cpp
@@ -148,7 +148,13 @@ btHeightfieldTerrainShape *ShapeBullet::create_shape_height_field(PoolVector<rea
const bool flipQuadEdges = false;
const void *heightsPtr = p_heights.read().ptr();
- return bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges));
+ btHeightfieldTerrainShape *heightfield = bulletnew(btHeightfieldTerrainShape(p_width, p_depth, heightsPtr, ignoredHeightScale, p_min_height, p_max_height, YAxis, PHY_FLOAT, flipQuadEdges));
+
+ // The shape can be created without params when you do PhysicsServer.shape_create(PhysicsServer.SHAPE_HEIGHTMAP)
+ if (heightsPtr)
+ heightfield->buildAccelerator(16);
+
+ return heightfield;
}
btRayShape *ShapeBullet::create_shape_ray(real_t p_length, bool p_slips_on_slope) {