BUlletSim: move safeynet ground plane to lower altitude. Define new BulletSim
parameter 'TerrainGroundPlane' which defaults to -500. BulletSim had assumed altitudes never went negative but that is not true. The ground plane is just a safety net so things wouldn't fall to infinity.0.8.0.3
parent
cb8c3ba023
commit
63aea3a5f2
|
@ -97,6 +97,7 @@ public static class BSParam
|
|||
|
||||
public static float TerrainImplementation { get; set; }
|
||||
public static int TerrainMeshMagnification { get; private set; }
|
||||
public static float TerrainGroundPlane { get; private set; }
|
||||
public static float TerrainFriction { get; private set; }
|
||||
public static float TerrainHitFraction { get; private set; }
|
||||
public static float TerrainRestitution { get; private set; }
|
||||
|
@ -544,6 +545,8 @@ public static class BSParam
|
|||
(float)BSTerrainPhys.TerrainImplementation.Heightmap ),
|
||||
new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
|
||||
2 ),
|
||||
new ParameterDefn<float>("TerrainGroundPlane", "Altitude of ground plane used to keep things from falling to infinity" ,
|
||||
-500.0f ),
|
||||
new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" ,
|
||||
0.3f ),
|
||||
new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" ,
|
||||
|
|
|
@ -136,9 +136,10 @@ public sealed class BSTerrainManager : IDisposable
|
|||
{
|
||||
DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName);
|
||||
// The ground plane is here to catch things that are trying to drop to negative infinity
|
||||
BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
|
||||
BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
|
||||
Vector3 groundPlaneAltitude = new Vector3(0f, 0f, BSParam.TerrainGroundPlane);
|
||||
m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
|
||||
BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity);
|
||||
BSScene.GROUNDPLANE_ID, groundPlaneAltitude, Quaternion.Identity);
|
||||
|
||||
// Everything collides with the ground plane.
|
||||
m_groundPlane.collisionType = CollisionType.Groundplane;
|
||||
|
|
Loading…
Reference in New Issue