diff options
author | Marc Gilleron <marc.gilleron@gmail.com> | 2019-01-01 22:15:18 +0000 |
---|---|---|
committer | Marc Gilleron <marc.gilleron@gmail.com> | 2019-02-01 14:57:17 +0100 |
commit | bd9f92cdf8f886b957c9fd88a7e5de91c2c52ebc (patch) | |
tree | 18aeee53f429c854ca8d18360f987625a99866a4 /modules | |
parent | 463123a661151f119132f2ee9af78925a58a068a (diff) |
Implemented terrain raycast acceleration using Bresenham traversal and 1 level of chunks
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 1aba31f03d..717a1c120a 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) { |