aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs73
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs9
2 files changed, 79 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 13d5e03..6963af5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -240,6 +240,15 @@ public class BSScene : PhysicsScene, IPhysicsParameters
240 parms.avatarDensity = 60f; 240 parms.avatarDensity = 60f;
241 parms.avatarCapsuleRadius = 0.37f; 241 parms.avatarCapsuleRadius = 0.37f;
242 parms.avatarCapsuleHeight = 1.5f; // 2.140599f 242 parms.avatarCapsuleHeight = 1.5f; // 2.140599f
243 parms.avatarContactProcessingThreshold = 0.1f;
244
245 parms.maxPersistantManifoldPoolSize = 0f;
246 parms.shouldDisableContactPoolDynamicAllocation = ConfigurationParameters.numericTrue;
247 parms.shouldForceUpdateAllAabbs = ConfigurationParameters.numericFalse;
248 parms.shouldRandomizeSolverOrder = ConfigurationParameters.numericFalse;
249 parms.shouldSplitSimulationIslands = ConfigurationParameters.numericFalse;
250 parms.shouldEnableFrictionCaching = ConfigurationParameters.numericFalse;
251 parms.numberOfSolverIterations = 0f; // means use default
243 252
244 if (config != null) 253 if (config != null)
245 { 254 {
@@ -285,11 +294,36 @@ public class BSScene : PhysicsScene, IPhysicsParameters
285 parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity); 294 parms.avatarDensity = pConfig.GetFloat("AvatarDensity", parms.avatarDensity);
286 parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius); 295 parms.avatarCapsuleRadius = pConfig.GetFloat("AvatarCapsuleRadius", parms.avatarCapsuleRadius);
287 parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight); 296 parms.avatarCapsuleHeight = pConfig.GetFloat("AvatarCapsuleHeight", parms.avatarCapsuleHeight);
297 parms.avatarContactProcessingThreshold = pConfig.GetFloat("AvatarContactProcessingThreshold", parms.avatarContactProcessingThreshold);
298
299 parms.maxPersistantManifoldPoolSize = pConfig.GetFloat("MaxPersistantManifoldPoolSize", parms.maxPersistantManifoldPoolSize);
300 parms.shouldDisableContactPoolDynamicAllocation = ParamBoolean(pConfig, "ShouldDisableContactPoolDynamicAllocation", parms.shouldDisableContactPoolDynamicAllocation);
301 parms.shouldForceUpdateAllAabbs = ParamBoolean(pConfig, "ShouldForceUpdateAllAabbs", parms.shouldForceUpdateAllAabbs);
302 parms.shouldRandomizeSolverOrder = ParamBoolean(pConfig, "ShouldRandomizeSolverOrder", parms.shouldRandomizeSolverOrder);
303 parms.shouldSplitSimulationIslands = ParamBoolean(pConfig, "ShouldSplitSimulationIslands", parms.shouldSplitSimulationIslands);
304 parms.shouldEnableFrictionCaching = ParamBoolean(pConfig, "ShouldEnableFrictionCaching", parms.shouldEnableFrictionCaching);
305 parms.numberOfSolverIterations = pConfig.GetFloat("NumberOfSolverIterations", parms.numberOfSolverIterations);
288 } 306 }
289 } 307 }
290 m_params[0] = parms; 308 m_params[0] = parms;
291 } 309 }
292 310
311 // A helper function that handles a true/false parameter and returns the proper float number encoding
312 float ParamBoolean(IConfig config, string parmName, float deflt)
313 {
314 float ret = deflt;
315 if (config.Contains(parmName))
316 {
317 ret = ConfigurationParameters.numericFalse;
318 if (config.GetBoolean(parmName, false))
319 {
320 ret = ConfigurationParameters.numericTrue;
321 }
322 }
323 return ret;
324 }
325
326
293 // Called directly from unmanaged code so don't do much 327 // Called directly from unmanaged code so don't do much
294 private void BulletLogger(string msg) 328 private void BulletLogger(string msg)
295 { 329 {
@@ -716,9 +750,20 @@ public class BSScene : PhysicsScene, IPhysicsParameters
716 new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ), 750 new PhysParameterEntry("DeactivationTime", "Seconds before considering an object potentially static" ),
717 new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ), 751 new PhysParameterEntry("LinearSleepingThreshold", "Seconds to measure linear movement before considering static" ),
718 new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ), 752 new PhysParameterEntry("AngularSleepingThreshold", "Seconds to measure angular movement before considering static" ),
719 // new PhysParameterEntry("CcdMotionThreshold", "" ), 753 new PhysParameterEntry("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ),
720 // new PhysParameterEntry("CcdSweptSphereRadius", "" ), 754 new PhysParameterEntry("CcdSweptSphereRadius", "Continuious collision detection test radius" ),
721 new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ), 755 new PhysParameterEntry("ContactProcessingThreshold", "Distance between contacts before doing collision check" ),
756 // Can only change the following at initialization time. Change the INI file and reboot.
757 new PhysParameterEntry("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default)"),
758 new PhysParameterEntry("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count"),
759 new PhysParameterEntry("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step"),
760 new PhysParameterEntry("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction"),
761 new PhysParameterEntry("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands"),
762 new PhysParameterEntry("ShouldEnableFrictionCaching", "Enable friction computation caching"),
763 new PhysParameterEntry("NumberOfSolverIterations", "Number of internal iterations (0 means default)"),
764
765 new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ),
766 new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ),
722 767
723 new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ), 768 new PhysParameterEntry("Friction", "Set friction parameter for a specific object" ),
724 new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ), 769 new PhysParameterEntry("Restitution", "Set restitution parameter for a specific object" ),
@@ -730,7 +775,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
730 new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ), 775 new PhysParameterEntry("AvatarDensity", "Density of an avatar. Changed on avatar recreation." ),
731 new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ), 776 new PhysParameterEntry("AvatarRestitution", "Bouncyness. Changed on avatar recreation." ),
732 new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ), 777 new PhysParameterEntry("AvatarCapsuleRadius", "Radius of space around an avatar" ),
733 new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ) 778 new PhysParameterEntry("AvatarCapsuleHeight", "Default height of space around avatar" ),
779 new PhysParameterEntry("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions")
780
734 }; 781 };
735 782
736 #region IPhysicsParameters 783 #region IPhysicsParameters
@@ -774,6 +821,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters
774 case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break; 821 case "ccdmotionthreshold": UpdateParameterPrims(ref m_params[0].ccdMotionThreshold, lparm, localID, val); break;
775 case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break; 822 case "ccdsweptsphereradius": UpdateParameterPrims(ref m_params[0].ccdSweptSphereRadius, lparm, localID, val); break;
776 case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break; 823 case "contactprocessingthreshold": UpdateParameterPrims(ref m_params[0].contactProcessingThreshold, lparm, localID, val); break;
824 // the following are used only at initialization time so setting them makes no sense
825 // case "maxPersistantmanifoldpoolSize": m_params[0].maxPersistantManifoldPoolSize = val; break;
826 // case "shoulddisablecontactpooldynamicallocation": m_params[0].shouldDisableContactPoolDynamicAllocation = val; break;
827 // case "shouldforceupdateallaabbs": m_params[0].shouldForceUpdateAllAabbs = val; break;
828 // case "shouldrandomizesolverorder": m_params[0].shouldRandomizeSolverOrder = val; break;
829 // case "shouldsplitsimulationislands": m_params[0].shouldSplitSimulationIslands = val; break;
830 // case "shouldenablefrictioncaching": m_params[0].shouldEnableFrictionCaching = val; break;
831 // case "numberofsolveriterations": m_params[0].numberOfSolverIterations = val; break;
832
833 case "friction": TaintedUpdateParameter(lparm, localID, val); break;
834 case "restitution": TaintedUpdateParameter(lparm, localID, val); break;
777 835
778 case "friction": TaintedUpdateParameter(lparm, localID, val); break; 836 case "friction": TaintedUpdateParameter(lparm, localID, val); break;
779 case "restitution": TaintedUpdateParameter(lparm, localID, val); break; 837 case "restitution": TaintedUpdateParameter(lparm, localID, val); break;
@@ -788,6 +846,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
788 case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break; 846 case "avatarrestitution": UpdateParameterAvatars(ref m_params[0].avatarRestitution, "avatar", localID, val); break;
789 case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break; 847 case "avatarcapsuleradius": UpdateParameterAvatars(ref m_params[0].avatarCapsuleRadius, "avatar", localID, val); break;
790 case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break; 848 case "avatarcapsuleheight": UpdateParameterAvatars(ref m_params[0].avatarCapsuleHeight, "avatar", localID, val); break;
849 case "avatarcontactprocessingthreshold": UpdateParameterAvatars(ref m_params[0].avatarContactProcessingThreshold, "avatar", localID, val); break;
791 850
792 default: ret = false; break; 851 default: ret = false; break;
793 } 852 }
@@ -880,6 +939,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
880 case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break; 939 case "ccdmotionthreshold": val = m_params[0].ccdMotionThreshold; break;
881 case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break; 940 case "ccdsweptsphereradius": val = m_params[0].ccdSweptSphereRadius; break;
882 case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break; 941 case "contactprocessingthreshold": val = m_params[0].contactProcessingThreshold; break;
942 case "maxPersistantmanifoldpoolSize": val = m_params[0].maxPersistantManifoldPoolSize; break;
943 case "shoulddisablecontactpooldynamicallocation": val = m_params[0].shouldDisableContactPoolDynamicAllocation; break;
944 case "shouldforceupdateallaabbs": val = m_params[0].shouldForceUpdateAllAabbs; break;
945 case "shouldrandomizesolverorder": val = m_params[0].shouldRandomizeSolverOrder; break;
946 case "shouldsplitsimulationislands": val = m_params[0].shouldSplitSimulationIslands; break;
947 case "shouldenablefrictioncaching": val = m_params[0].shouldEnableFrictionCaching; break;
948 case "numberofsolveriterations": val = m_params[0].numberOfSolverIterations; break;
883 949
884 case "terrainfriction": val = m_params[0].terrainFriction; break; 950 case "terrainfriction": val = m_params[0].terrainFriction; break;
885 case "terrainhitfraction": val = m_params[0].terrainHitFraction; break; 951 case "terrainhitfraction": val = m_params[0].terrainHitFraction; break;
@@ -890,6 +956,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters
890 case "avatarrestitution": val = m_params[0].avatarRestitution; break; 956 case "avatarrestitution": val = m_params[0].avatarRestitution; break;
891 case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break; 957 case "avatarcapsuleradius": val = m_params[0].avatarCapsuleRadius; break;
892 case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break; 958 case "avatarcapsuleheight": val = m_params[0].avatarCapsuleHeight; break;
959 case "avatarcontactprocessingthreshold": val = m_params[0].avatarContactProcessingThreshold; break;
893 default: ret = false; break; 960 default: ret = false; break;
894 961
895 } 962 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index aab0994..086f0dc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -132,6 +132,15 @@ public struct ConfigurationParameters
132 public float avatarRestitution; 132 public float avatarRestitution;
133 public float avatarCapsuleRadius; 133 public float avatarCapsuleRadius;
134 public float avatarCapsuleHeight; 134 public float avatarCapsuleHeight;
135 public float avatarContactProcessingThreshold;
136
137 public float maxPersistantManifoldPoolSize;
138 public float shouldDisableContactPoolDynamicAllocation;
139 public float shouldForceUpdateAllAabbs;
140 public float shouldRandomizeSolverOrder;
141 public float shouldSplitSimulationIslands;
142 public float shouldEnableFrictionCaching;
143 public float numberOfSolverIterations;
135 144
136 public const float numericTrue = 1f; 145 public const float numericTrue = 1f;
137 public const float numericFalse = 0f; 146 public const float numericFalse = 0f;