From eafc3d6c47b736ca6e4d777c8bcaf059d116ed4c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 16 Mar 2012 08:59:41 -0700 Subject: BulletSim: Update list of TODO tasks --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index e9a849c..b1e551c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -52,6 +52,19 @@ using OpenSim.Region.Framework; // Implement LockAngularMotion // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) // Does NeedsMeshing() really need to exclude all the different shapes? +// Remove mesh and Hull stuff. Use mesh passed to bullet and use convexdecom from bullet. +// Add PID movement operations +// Debug linkset +// Ccd threshold to defaults (0.0) +// Command line get and set is broken +// Check terrain size. 128 or 127? +// Test with multiple regions in one simulator +// Multiple contact points on collision? +// See code in ode::near... calls to collision_accounting_events() +// Use collision masks for collision with terrain and phantom objects +// Check out llVolumeDetect. Must do something for that. +// Physical phantom objects and related typing (collision options ) +// Raycast // namespace OpenSim.Region.Physics.BulletSPlugin { -- cgit v1.1 From 898a16802bceab9cc43ad15be6f4354335b471fb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 16 Mar 2012 16:37:21 -0700 Subject: BulletSim: add some new runtime setable parameters to match the dll. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index b1e551c..977dcbe 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -177,6 +177,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters if (m_log.IsDebugEnabled) { m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); + // the handle is saved to it doesn't get freed after this call m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); } @@ -185,7 +186,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters mesher = meshmerizer; // The bounding box for the simulated world - Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 4096f); + Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f); // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), @@ -233,7 +234,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainFriction = 0.5f; parms.terrainHitFraction = 0.8f; parms.terrainRestitution = 0f; - parms.avatarFriction = 0.0f; + parms.avatarFriction = 0.5f; parms.avatarDensity = 60f; parms.avatarCapsuleRadius = 0.37f; parms.avatarCapsuleHeight = 1.5f; // 2.140599f @@ -716,6 +717,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters // new PhysParameterEntry("CcdSweptSphereRadius", "" ), new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), + new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), + new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), + new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), new PhysParameterEntry("TerrainRestitution", "Bouncyness" ), @@ -756,7 +760,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "defaultdensity": m_params[0].defaultDensity = val; break; case "defaultrestitution": m_params[0].defaultRestitution = val; break; case "collisionmargin": m_params[0].collisionMargin = val; break; - case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; + case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break; case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; @@ -767,6 +771,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; + case "friction": TaintedUpdateParameter(lparm, localID, val); break; + case "restitution": TaintedUpdateParameter(lparm, localID, val); break; + // set a terrain physical feature and cause terrain to be recalculated case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; case "terrainhitfraction": m_params[0].terrainHitFraction = val; TaintedUpdateParameter("terrain", 0, val); break; -- cgit v1.1 From cb2727cf6e7b40473d10cfbea61155f5bcf6646f Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 18 Mar 2012 11:53:53 -0700 Subject: BulletSim: Add AvatarRestitution parameter. Centralize computation of buoyancy for flying. Tweek avatar default friction and resititution --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 977dcbe..9b12b4f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -235,6 +235,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainHitFraction = 0.8f; parms.terrainRestitution = 0f; parms.avatarFriction = 0.5f; + parms.avatarRestitution = 0.0f; parms.avatarDensity = 60f; parms.avatarCapsuleRadius = 0.37f; parms.avatarCapsuleHeight = 1.5f; // 2.140599f @@ -279,7 +280,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution); parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction); + parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); + parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); } -- cgit v1.1 From 7783c93802f61d4ed9994c3f9e924066be0469be Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 21 Mar 2012 07:07:44 -0700 Subject: BulletSim: update TODO list. Rearrange code for readability. Add per object friction and restitution runtime settable parameters. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 9b12b4f..142103b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -37,14 +37,18 @@ using OpenMetaverse; using OpenSim.Region.Framework; // TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) +// Debug linkset +// Test with multiple regions in one simulator // Adjust character capsule size when height is adjusted (ScenePresence.SetHeight) // Test sculpties // Compute physics FPS reasonably // Based on material, set density and friction -// More efficient memory usage in passing hull information from BSPrim to BulletSim +// More efficient memory usage when passing hull information from BSPrim to BulletSim // Four states of prim: Physical, regular, phantom and selected. Are we modeling these correctly? // In SL one can set both physical and phantom (gravity, does not effect others, makes collisions with ground) // At the moment, physical and phantom causes object to drop through the terrain +// Physical phantom objects and related typing (collision options ) +// Check out llVolumeDetect. Must do something for that. // Should prim.link() and prim.delink() membership checking happen at taint time? // Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once // Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect @@ -53,17 +57,14 @@ using OpenSim.Region.Framework; // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) // Does NeedsMeshing() really need to exclude all the different shapes? // Remove mesh and Hull stuff. Use mesh passed to bullet and use convexdecom from bullet. -// Add PID movement operations -// Debug linkset -// Ccd threshold to defaults (0.0) -// Command line get and set is broken +// Add PID movement operations. What does ScenePresence.MoveToTarget do? // Check terrain size. 128 or 127? -// Test with multiple regions in one simulator // Multiple contact points on collision? // See code in ode::near... calls to collision_accounting_events() +// (This might not be a problem. ODE collects all the collisions with one object in one tick.) // Use collision masks for collision with terrain and phantom objects -// Check out llVolumeDetect. Must do something for that. -// Physical phantom objects and related typing (collision options ) +// Figure out how to not allocate a new Dictionary and List for every collision +// in BSPrim.Collide() and BSCharacter.Collide(). Can the same ones be reused? // Raycast // namespace OpenSim.Region.Physics.BulletSPlugin @@ -282,7 +283,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction); parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); - parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); } @@ -408,16 +408,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters { EntityProperties entprop = m_updateArray[ii]; // m_log.DebugFormat("{0}: entprop[{1}]: id={2}, pos={3}", LogHeader, ii, entprop.ID, entprop.Position); - BSCharacter actor; - if (m_avatars.TryGetValue(entprop.ID, out actor)) - { - actor.UpdateProperties(entprop); - continue; - } BSPrim prim; if (m_prims.TryGetValue(entprop.ID, out prim)) { prim.UpdateProperties(entprop); + continue; + } + BSCharacter actor; + if (m_avatars.TryGetValue(entprop.ID, out actor)) + { + actor.UpdateProperties(entprop); } } } -- cgit v1.1 From efe61b2481ce10f16b156542c122971d35c227e1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 22 Mar 2012 17:04:06 -0700 Subject: BulletSim: remove confusion between angularVelocity and rotationalVelocity (there is still confusion in the rest of OpenSim). Enhance some debug statements to include the object ID. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 142103b..13d5e03 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -487,12 +487,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters public override void DeleteTerrain() { - m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); + // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); } public override void Dispose() { - m_log.DebugFormat("{0}: Dispose()", LogHeader); + // m_log.DebugFormat("{0}: Dispose()", LogHeader); } public override Dictionary GetTopColliders() @@ -753,6 +753,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters switch (lparm) { case "detailedstats": m_detailedStatsStep = (int)val; break; + case "meshlod": m_meshLOD = (int)val; break; case "sculptlod": m_sculptLOD = (int)val; break; case "maxsubstep": m_maxSubSteps = (int)val; break; -- cgit v1.1 From 975184b3f94e169a720ee1dd9044f09a7dbb77cd Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 16 Mar 2012 08:59:41 -0700 Subject: BulletSim: Update list of TODO tasks --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index e9a849c..b1e551c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -52,6 +52,19 @@ using OpenSim.Region.Framework; // Implement LockAngularMotion // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) // Does NeedsMeshing() really need to exclude all the different shapes? +// Remove mesh and Hull stuff. Use mesh passed to bullet and use convexdecom from bullet. +// Add PID movement operations +// Debug linkset +// Ccd threshold to defaults (0.0) +// Command line get and set is broken +// Check terrain size. 128 or 127? +// Test with multiple regions in one simulator +// Multiple contact points on collision? +// See code in ode::near... calls to collision_accounting_events() +// Use collision masks for collision with terrain and phantom objects +// Check out llVolumeDetect. Must do something for that. +// Physical phantom objects and related typing (collision options ) +// Raycast // namespace OpenSim.Region.Physics.BulletSPlugin { -- cgit v1.1 From b22d0401693dad44790d4cbf58d85c0fe3870460 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 16 Mar 2012 16:37:21 -0700 Subject: BulletSim: add some new runtime setable parameters to match the dll. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index b1e551c..977dcbe 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -177,6 +177,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters if (m_log.IsDebugEnabled) { m_log.DebugFormat("{0}: Initialize: Setting debug callback for unmanaged code", LogHeader); + // the handle is saved to it doesn't get freed after this call m_DebugLogCallbackHandle = new BulletSimAPI.DebugLogCallback(BulletLogger); BulletSimAPI.SetDebugLogCallback(m_DebugLogCallbackHandle); } @@ -185,7 +186,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters mesher = meshmerizer; // The bounding box for the simulated world - Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 4096f); + Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, 8192f); // m_log.DebugFormat("{0}: Initialize: Calling BulletSimAPI.Initialize.", LogHeader); m_worldID = BulletSimAPI.Initialize(worldExtent, m_paramsHandle.AddrOfPinnedObject(), @@ -233,7 +234,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainFriction = 0.5f; parms.terrainHitFraction = 0.8f; parms.terrainRestitution = 0f; - parms.avatarFriction = 0.0f; + parms.avatarFriction = 0.5f; parms.avatarDensity = 60f; parms.avatarCapsuleRadius = 0.37f; parms.avatarCapsuleHeight = 1.5f; // 2.140599f @@ -716,6 +717,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters // new PhysParameterEntry("CcdSweptSphereRadius", "" ), new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), + new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), + new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), + new PhysParameterEntry("TerrainFriction", "Factor to reduce movement against terrain surface" ), new PhysParameterEntry("TerrainHitFraction", "Distance to measure hit collisions" ), new PhysParameterEntry("TerrainRestitution", "Bouncyness" ), @@ -756,7 +760,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "defaultdensity": m_params[0].defaultDensity = val; break; case "defaultrestitution": m_params[0].defaultRestitution = val; break; case "collisionmargin": m_params[0].collisionMargin = val; break; - case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, PhysParameterEntry.APPLY_TO_NONE, val); break; + case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break; case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; case "angulardamping": UpdateParameterPrims(ref m_params[0].angularDamping, lparm, localID, val); break; @@ -767,6 +771,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; + case "friction": TaintedUpdateParameter(lparm, localID, val); break; + case "restitution": TaintedUpdateParameter(lparm, localID, val); break; + // set a terrain physical feature and cause terrain to be recalculated case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; case "terrainhitfraction": m_params[0].terrainHitFraction = val; TaintedUpdateParameter("terrain", 0, val); break; -- cgit v1.1 From de24feb275ddd1c7e7c0b04900718a9000b8d49b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 18 Mar 2012 11:53:53 -0700 Subject: BulletSim: Add AvatarRestitution parameter. Centralize computation of buoyancy for flying. Tweek avatar default friction and resititution --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 977dcbe..9b12b4f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -235,6 +235,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainHitFraction = 0.8f; parms.terrainRestitution = 0f; parms.avatarFriction = 0.5f; + parms.avatarRestitution = 0.0f; parms.avatarDensity = 60f; parms.avatarCapsuleRadius = 0.37f; parms.avatarCapsuleHeight = 1.5f; // 2.140599f @@ -279,7 +280,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.terrainHitFraction = pConfig.GetFloat("TerrainHitFraction", parms.terrainHitFraction); parms.terrainRestitution = pConfig.GetFloat("TerrainRestitution", parms.terrainRestitution); parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction); + parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); + parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); } -- cgit v1.1 From 1a738caecab74c5b9f6b6bac69a3ea9ccdc80b24 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 21 Mar 2012 07:07:44 -0700 Subject: BulletSim: update TODO list. Rearrange code for readability. Add per object friction and restitution runtime settable parameters. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 9b12b4f..142103b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -37,14 +37,18 @@ using OpenMetaverse; using OpenSim.Region.Framework; // TODOs for BulletSim (for BSScene, BSPrim, BSCharacter and BulletSim) +// Debug linkset +// Test with multiple regions in one simulator // Adjust character capsule size when height is adjusted (ScenePresence.SetHeight) // Test sculpties // Compute physics FPS reasonably // Based on material, set density and friction -// More efficient memory usage in passing hull information from BSPrim to BulletSim +// More efficient memory usage when passing hull information from BSPrim to BulletSim // Four states of prim: Physical, regular, phantom and selected. Are we modeling these correctly? // In SL one can set both physical and phantom (gravity, does not effect others, makes collisions with ground) // At the moment, physical and phantom causes object to drop through the terrain +// Physical phantom objects and related typing (collision options ) +// Check out llVolumeDetect. Must do something for that. // Should prim.link() and prim.delink() membership checking happen at taint time? // Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once // Do attachments need to be handled separately? Need collision events. Do not collide with VolumeDetect @@ -53,17 +57,14 @@ using OpenSim.Region.Framework; // Decide if clearing forces is the right thing to do when setting position (BulletSim::SetObjectTranslation) // Does NeedsMeshing() really need to exclude all the different shapes? // Remove mesh and Hull stuff. Use mesh passed to bullet and use convexdecom from bullet. -// Add PID movement operations -// Debug linkset -// Ccd threshold to defaults (0.0) -// Command line get and set is broken +// Add PID movement operations. What does ScenePresence.MoveToTarget do? // Check terrain size. 128 or 127? -// Test with multiple regions in one simulator // Multiple contact points on collision? // See code in ode::near... calls to collision_accounting_events() +// (This might not be a problem. ODE collects all the collisions with one object in one tick.) // Use collision masks for collision with terrain and phantom objects -// Check out llVolumeDetect. Must do something for that. -// Physical phantom objects and related typing (collision options ) +// Figure out how to not allocate a new Dictionary and List for every collision +// in BSPrim.Collide() and BSCharacter.Collide(). Can the same ones be reused? // Raycast // namespace OpenSim.Region.Physics.BulletSPlugin @@ -282,7 +283,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.avatarFriction = pConfig.GetFloat("AvatarFriction", parms.avatarFriction); parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); - parms.avatarRestitution = pConfig.GetFloat("AvatarRestitution", parms.avatarRestitution); parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); } @@ -408,16 +408,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters { EntityProperties entprop = m_updateArray[ii]; // m_log.DebugFormat("{0}: entprop[{1}]: id={2}, pos={3}", LogHeader, ii, entprop.ID, entprop.Position); - BSCharacter actor; - if (m_avatars.TryGetValue(entprop.ID, out actor)) - { - actor.UpdateProperties(entprop); - continue; - } BSPrim prim; if (m_prims.TryGetValue(entprop.ID, out prim)) { prim.UpdateProperties(entprop); + continue; + } + BSCharacter actor; + if (m_avatars.TryGetValue(entprop.ID, out actor)) + { + actor.UpdateProperties(entprop); } } } -- cgit v1.1 From 1273f259e46154f861104610e8f6029b3c19623d Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 22 Mar 2012 17:04:06 -0700 Subject: BulletSim: remove confusion between angularVelocity and rotationalVelocity (there is still confusion in the rest of OpenSim). Enhance some debug statements to include the object ID. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 142103b..13d5e03 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -487,12 +487,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters public override void DeleteTerrain() { - m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); + // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); } public override void Dispose() { - m_log.DebugFormat("{0}: Dispose()", LogHeader); + // m_log.DebugFormat("{0}: Dispose()", LogHeader); } public override Dictionary GetTopColliders() @@ -753,6 +753,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters switch (lparm) { case "detailedstats": m_detailedStatsStep = (int)val; break; + case "meshlod": m_meshLOD = (int)val; break; case "sculptlod": m_sculptLOD = (int)val; break; case "maxsubstep": m_maxSubSteps = (int)val; break; -- cgit v1.1 From 142de1d02f086c80888eb216cfd31b84ec27a79b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 23 Mar 2012 10:59:40 -0700 Subject: BulletSim: add a bunch of internal Bullet configuration parameters to OpenSimDefaults.ini and the code. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 13d5e03..8d0f9a6 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -240,6 +240,15 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.avatarDensity = 60f; parms.avatarCapsuleRadius = 0.37f; parms.avatarCapsuleHeight = 1.5f; // 2.140599f + parms.avatarContactProcessingThreshold = 0.1f; + + parms.maxPersistantManifoldPoolSize = 0f; + parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericFalse; + parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse; + parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse; + parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse; + parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse; + parms.numberOfSolverIterations = 0f; // means use default if (config != null) { @@ -285,11 +294,36 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); + parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold); + + parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize); + parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation); + parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs); + parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder); + parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands); + parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching); + parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations); } } m_params[0] = parms; } + // A helper function that handles a true/false parameter and returns the proper float number encoding + float ParamBoolean(IConfig config, string parmName, float deflt) + { + float ret = deflt; + if (config.Contains(parmName)) + { + ret = ConfigurationParameters.numericFalse; + if (config.GetBoolean(parmName, false)) + { + ret = ConfigurationParameters.numericTrue; + } + } + return ret; + } + + // Called directly from unmanaged code so don't do much private void BulletLogger(string msg) { -- cgit v1.1 From 3f53b7bc919b8270327911c3bc8ea71640c68c81 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 23 Mar 2012 12:12:06 -0700 Subject: BulletSim: Add new configuration parameters to get and set console commands --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 36 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 8d0f9a6..8d2e25f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -750,9 +750,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), - // new PhysParameterEntry("CcdMotionThreshold", "" ), - // new PhysParameterEntry("CcdSweptSphereRadius", "" ), + new PhysParameterEntry("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ), + new PhysParameterEntry("CcdSweptSphereRadius", "Continuious collision detection test radius" ), new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), + // Can only change the following at initialization time. Change the INI file and reboot. + new PhysParameterEntry("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)"), + new PhysParameterEntry("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count"), + new PhysParameterEntry("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step"), + new PhysParameterEntry("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction"), + new PhysParameterEntry("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands"), + new PhysParameterEntry("ShouldEnableFrictionCaching", "Enable friction computation caching"), + new PhysParameterEntry("NumberOfSolverIterations", "Number of internal iterations (0 means default)"), new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), @@ -764,7 +772,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), - new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ) + new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ), + new PhysParameterEntry("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions") + }; #region IPhysicsParameters @@ -798,6 +808,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "defaultdensity": m_params[0].defaultDensity = val; break; case "defaultrestitution": m_params[0].defaultRestitution = val; break; case "collisionmargin": m_params[0].collisionMargin = val; break; + case "gravity": m_params[0].gravity = val; TaintedUpdateParameter(lparm, localID, val); break; case "lineardamping": UpdateParameterPrims(ref m_params[0].linearDamping, lparm, localID, val); break; @@ -808,6 +819,14 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; + // the following are used only at initialization time so setting them makes no sense + // case "maxPersistantmanifoldpoolSize": m_params[0].maxPersistantManifoldPoolSize = val; break; + // case "shoulddisablecontactpooldynamicallocation": m_params[0].shouldDisableContactPoolDynamicAllocation = val; break; + // case "shouldforceupdateallaabbs": m_params[0].shouldForceUpdateAllAabbs = val; break; + // case "shouldrandomizesolverorder": m_params[0].shouldRandomizeSolverOrder = val; break; + // case "shouldsplitsimulationislands": m_params[0].shouldSplitSimulationIslands = val; break; + // case "shouldenablefrictioncaching": m_params[0].shouldEnableFrictionCaching = val; break; + // case "numberofsolveriterations": m_params[0].numberOfSolverIterations = val; break; case "friction": TaintedUpdateParameter(lparm, localID, val); break; case "restitution": TaintedUpdateParameter(lparm, localID, val); break; @@ -821,7 +840,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; - case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; + case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; + case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break; default: ret = false; break; } @@ -914,6 +934,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; + case "maxPersistantmanifoldpoolSize": val = m_params[0].maxPersistantManifoldPoolSize; break; + case "shoulddisablecontactpooldynamicallocation": val = m_params[0].shouldDisableContactPoolDynamicAllocation; break; + case "shouldforceupdateallaabbs": val = m_params[0].shouldForceUpdateAllAabbs; break; + case "shouldrandomizesolverorder": val = m_params[0].shouldRandomizeSolverOrder; break; + case "shouldsplitsimulationislands": val = m_params[0].shouldSplitSimulationIslands; break; + case "shouldenablefrictioncaching": val = m_params[0].shouldEnableFrictionCaching; break; + case "numberofsolveriterations": val = m_params[0].numberOfSolverIterations; break; case "terrainfriction": val = m_params[0].terrainFriction; break; case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; @@ -924,6 +951,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "avatarrestitution": val = m_params[0].avatarRestitution; break; case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break; case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break; + case "avatarcontactprocessingthreshold": val = m_params[0].avatarContactProcessingThreshold; break; default: ret = false; break; } -- cgit v1.1 From ff54b3c3661a6bf9d5f0d9a24f8aeed5b42ce0ce Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 23 Mar 2012 15:50:32 -0700 Subject: BulletSim: change default of shouldDisableContactPoolDynamicAllocation from False to True. It seems that collisions don't happen well when it is False (things fall through terrain). --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 8d2e25f..36dead0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -243,7 +243,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters parms.avatarContactProcessingThreshold = 0.1f; parms.maxPersistantManifoldPoolSize = 0f; - parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericFalse; + parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue; parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse; parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse; parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse; @@ -840,7 +840,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "avatardensity": UpdateParameterAvatars(ref m_params[0].avatarDensity, "avatar", localID, val); break; case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; - case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; + case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break; default: ret = false; break; -- cgit v1.1 From 2fcdecf0900a5b458227ede4b34faec427f3cf28 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 26 Mar 2012 08:57:40 -0700 Subject: BulletSim: fix typo introducted by previous checkins (git merge sometimes makes mistakes) --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 6963af5..581d540 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -833,9 +833,6 @@ public class BSScene : PhysicsScene, IPhysicsParameters case "friction": TaintedUpdateParameter(lparm, localID, val); break; case "restitution": TaintedUpdateParameter(lparm, localID, val); break; - case "friction": TaintedUpdateParameter(lparm, localID, val); break; - case "restitution": TaintedUpdateParameter(lparm, localID, val); break; - // set a terrain physical feature and cause terrain to be recalculated case "terrainfriction": m_params[0].terrainFriction = val; TaintedUpdateParameter("terrain", 0, val); break; case "terrainhitfraction": m_params[0].terrainHitFraction = val; TaintedUpdateParameter("terrain", 0, val); break; -- cgit v1.1 From 872d513daaa68b94b78f71bd2a2d9a0f117ff727 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 26 Mar 2012 17:36:33 -0700 Subject: BulletSim: make avatar animations update properly. It seems that ODE calls the avatar collision handling routine even if there are no collisions. This causes the animation to be updated. So, for instance, going from HOVER to FLY is caused by the physics engine calling the collision routine each frame with 0 collisions. --- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 581d540..94a0ccf 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -78,6 +78,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters private Dictionary m_avatars = new Dictionary(); private Dictionary m_prims = new Dictionary(); + private HashSet m_avatarsWithCollisions = new HashSet(); + private HashSet m_primsWithCollisions = new HashSet(); private List m_vehicles = new List(); private float[] m_heightMap; private float m_waterLevel; @@ -435,6 +437,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters } } + // The SendCollision's batch up the collisions on the objects. Now push the collisions into the simulator. + foreach (BSPrim bsp in m_primsWithCollisions) + bsp.SendCollisions(); + m_primsWithCollisions.Clear(); + // foreach (BSCharacter bsc in m_avatarsWithCollisions) + // bsc.SendCollisions(); + // This is a kludge to get avatar movement updated. ODE sends collisions even if there isn't any + foreach (KeyValuePair kvp in m_avatars) + kvp.Value.SendCollisions(); + m_avatarsWithCollisions.Clear(); + // If any of the objects had updated properties, tell the object it has been changed by the physics engine if (updatedEntityCount > 0) { @@ -485,11 +498,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters BSPrim prim; if (m_prims.TryGetValue(localID, out prim)) { prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration); + m_primsWithCollisions.Add(prim); return; } BSCharacter actor; if (m_avatars.TryGetValue(localID, out actor)) { actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration); + m_avatarsWithCollisions.Add(actor); return; } return; -- cgit v1.1