BulletSim: default physical terrain implementation to heightmap.

It originally looked like mesh terrain would perform better for vehicles
but, after much use, heightmap is the clear winner.
Force terrain implementation to heightmap if the physics region is
larger than legacy region size. This solves running out of memory for
very large regions.
This commit is contained in:
Robert Adams
2014-01-29 06:44:14 -08:00
parent fbf33ef1de
commit 0842e2e15b
3 changed files with 11 additions and 3 deletions

View File

@@ -235,6 +235,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// Set default values for physics parameters plus any overrides from the ini file
GetInitialParameterValues(config);
// Force some parameters to values depending on other configurations
// Only use heightmap terrain implementation if terrain larger than legacy size
if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize)
{
m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader);
BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap;
}
// Get the connection to the physics engine (could be native or one of many DLLs)
PE = SelectUnderlyingBulletEngine(BulletEngineName);