From 63aea3a5f281ac396787beab5615214b36e2332e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 28 Apr 2014 11:08:47 -0700 Subject: 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. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 +++ OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index f2ad528..6683446 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -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("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 2 ), + new ParameterDefn("TerrainGroundPlane", "Altitude of ground plane used to keep things from falling to infinity" , + -500.0f ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 0.3f ), new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 3013077..9067a2c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs @@ -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; -- cgit v1.1