diff options
author | Hein-Pieter van Braam <hp@tmm.cx> | 2019-04-23 06:25:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-23 06:25:15 +0300 |
commit | 4575769115c22a191209fd3e81cdf61e19b505b1 (patch) | |
tree | 36fd7b3d6c716cc3152c71d85a77d74f8293f239 /modules | |
parent | c794107988a194284a1315a2808f2016ece5c8e6 (diff) | |
parent | bd9f92cdf8f886b957c9fd88a7e5de91c2c52ebc (diff) |
Merge pull request #25543 from Zylann/optimize_bullet_heightfield_raycast2
Implemented terrain raycast acceleration
Diffstat (limited to 'modules')
-rw-r--r-- | modules/bullet/shape_bullet.cpp | 8 |
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) { |