From 511122834b5cd95839029d28365e479dc25eae9d Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 23 Oct 2013 16:07:03 -0700 Subject: BulletSim: change collision flags for groundplane to not interact with static objects. Reorder collision flag setting code for terrain to fit pattern used elsewhere. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 5 +++++ OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs | 5 ++--- OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 7 ++++--- OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 43aa63e..834228e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -120,6 +120,7 @@ public static class BSParam public static float NumberOfSolverIterations { get; private set; } public static bool UseSingleSidedMeshes { get; private set; } public static float GlobalContactBreakingThreshold { get; private set; } + public static float PhysicsUnmanLoggingFrames { get; private set; } // Avatar parameters public static float AvatarFriction { get; private set; } @@ -671,6 +672,10 @@ public static class BSParam 0f, (s) => { return GlobalContactBreakingThreshold; }, (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), + new ParameterDefn("PhysicsUnmanLoggingFrames", "If non-zero, frames between output of detailed unmanaged physics statistics", + 0f, + (s) => { return PhysicsUnmanLoggingFrames; }, + (s,v) => { PhysicsUnmanLoggingFrames = v; s.UnmanagedParams[0].physicsLoggingFrames = v; } ), new ParameterDefn("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", 7 ), diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs index c7deb4e..8888d6d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs @@ -112,15 +112,14 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys m_physicsScene.PE.SetRestitution(m_mapInfo.terrainBody, BSParam.TerrainRestitution); m_physicsScene.PE.SetCollisionFlags(m_mapInfo.terrainBody, CollisionFlags.CF_STATIC_OBJECT); + m_mapInfo.terrainBody.collisionType = CollisionType.Terrain; + // Return the new terrain to the world of physical objects m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_mapInfo.terrainBody); // redo its bounding box now that it is in the world m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_mapInfo.terrainBody); - m_mapInfo.terrainBody.collisionType = CollisionType.Terrain; - m_mapInfo.terrainBody.ApplyCollisionMask(m_physicsScene); - // Make it so the terrain will not move or be considered for movement. m_physicsScene.PE.ForceActivationState(m_mapInfo.terrainBody, ActivationState.DISABLE_SIMULATION); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index c016eed..441d2d3 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs @@ -138,13 +138,14 @@ public sealed class BSTerrainManager : IDisposable m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape, BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity); + // Everything collides with the ground plane. + m_groundPlane.collisionType = CollisionType.Groundplane; + m_physicsScene.PE.AddObjectToWorld(m_physicsScene.World, m_groundPlane); m_physicsScene.PE.UpdateSingleAabb(m_physicsScene.World, m_groundPlane); + // Ground plane does not move m_physicsScene.PE.ForceActivationState(m_groundPlane, ActivationState.DISABLE_SIMULATION); - // Everything collides with the ground plane. - m_groundPlane.collisionType = CollisionType.Groundplane; - m_groundPlane.ApplyCollisionMask(m_physicsScene); BSTerrainPhys initialTerrain = new BSTerrainHeightmap(m_physicsScene, Vector3.Zero, BSScene.TERRAIN_ID, DefaultRegionSize); lock (m_terrains) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs index d5060e3..971ff9f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs @@ -235,7 +235,8 @@ public static Dictionary CollisionTypeM { CollisionType.Groundplane, new CollisionTypeFilterGroup(CollisionType.Groundplane, (uint)CollisionFilterGroups.BGroundPlaneGroup, - (uint)CollisionFilterGroups.BAllGroup) + // (uint)CollisionFilterGroups.BAllGroup) + (uint)(CollisionFilterGroups.BCharacterGroup | CollisionFilterGroups.BSolidGroup)) }, { CollisionType.Terrain, new CollisionTypeFilterGroup(CollisionType.Terrain, -- cgit v1.1