aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2013-02-03 16:08:09 -0800
committerRobert Adams2013-02-05 16:56:23 -0800
commitad438ee59fce1b262135ef0f7cd1213f3a79df50 (patch)
tree96871ce99daa85e8142c8ab3d6ec7e8ebeaa24ea /OpenSim/Region/Physics
parentBulletSim: correct angular vertical attraction to properly correct an upside ... (diff)
downloadopensim-SC-ad438ee59fce1b262135ef0f7cd1213f3a79df50.zip
opensim-SC-ad438ee59fce1b262135ef0f7cd1213f3a79df50.tar.gz
opensim-SC-ad438ee59fce1b262135ef0f7cd1213f3a79df50.tar.bz2
opensim-SC-ad438ee59fce1b262135ef0f7cd1213f3a79df50.tar.xz
BulletSim: rework some parameter setting implementation moving functionality that was in BSScene to BSParam. Remove unused parameters that were passed to the unmanaged code. Update DLLs and SOs for the new param block.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs70
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs38
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs131
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs58
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs13
5 files changed, 152 insertions, 158 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 04e77b8..39e62dd 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -1088,7 +1088,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
1088 { 1088 {
1089 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData(); 1089 CollisionWorld.WorldData.ParamData p = new CollisionWorld.WorldData.ParamData();
1090 1090
1091 p.angularDamping = o[0].XangularDamping; 1091 p.angularDamping = BSParam.AngularDamping;
1092 p.defaultFriction = o[0].defaultFriction; 1092 p.defaultFriction = o[0].defaultFriction;
1093 p.defaultFriction = o[0].defaultFriction; 1093 p.defaultFriction = o[0].defaultFriction;
1094 p.defaultDensity = o[0].defaultDensity; 1094 p.defaultDensity = o[0].defaultDensity;
@@ -1096,32 +1096,32 @@ private sealed class BulletConstraintXNA : BulletConstraint
1096 p.collisionMargin = o[0].collisionMargin; 1096 p.collisionMargin = o[0].collisionMargin;
1097 p.gravity = o[0].gravity; 1097 p.gravity = o[0].gravity;
1098 1098
1099 p.linearDamping = o[0].XlinearDamping; 1099 p.linearDamping = BSParam.LinearDamping;
1100 p.angularDamping = o[0].XangularDamping; 1100 p.angularDamping = BSParam.AngularDamping;
1101 p.deactivationTime = o[0].XdeactivationTime; 1101 p.deactivationTime = BSParam.DeactivationTime;
1102 p.linearSleepingThreshold = o[0].XlinearSleepingThreshold; 1102 p.linearSleepingThreshold = BSParam.LinearSleepingThreshold;
1103 p.angularSleepingThreshold = o[0].XangularSleepingThreshold; 1103 p.angularSleepingThreshold = BSParam.AngularSleepingThreshold;
1104 p.ccdMotionThreshold = o[0].XccdMotionThreshold; 1104 p.ccdMotionThreshold = BSParam.CcdMotionThreshold;
1105 p.ccdSweptSphereRadius = o[0].XccdSweptSphereRadius; 1105 p.ccdSweptSphereRadius = BSParam.CcdSweptSphereRadius;
1106 p.contactProcessingThreshold = o[0].XcontactProcessingThreshold; 1106 p.contactProcessingThreshold = BSParam.ContactProcessingThreshold;
1107 1107
1108 p.terrainImplementation = o[0].XterrainImplementation; 1108 p.terrainImplementation = BSParam.TerrainImplementation;
1109 p.terrainFriction = o[0].XterrainFriction; 1109 p.terrainFriction = BSParam.TerrainFriction;
1110 1110
1111 p.terrainHitFraction = o[0].XterrainHitFraction; 1111 p.terrainHitFraction = BSParam.TerrainHitFraction;
1112 p.terrainRestitution = o[0].XterrainRestitution; 1112 p.terrainRestitution = BSParam.TerrainRestitution;
1113 p.terrainCollisionMargin = o[0].XterrainCollisionMargin; 1113 p.terrainCollisionMargin = BSParam.TerrainCollisionMargin;
1114 1114
1115 p.avatarFriction = o[0].XavatarFriction; 1115 p.avatarFriction = BSParam.AvatarFriction;
1116 p.avatarStandingFriction = o[0].XavatarStandingFriction; 1116 p.avatarStandingFriction = BSParam.AvatarStandingFriction;
1117 p.avatarDensity = o[0].XavatarDensity; 1117 p.avatarDensity = BSParam.AvatarDensity;
1118 p.avatarRestitution = o[0].XavatarRestitution; 1118 p.avatarRestitution = BSParam.AvatarRestitution;
1119 p.avatarCapsuleWidth = o[0].XavatarCapsuleWidth; 1119 p.avatarCapsuleWidth = BSParam.AvatarCapsuleWidth;
1120 p.avatarCapsuleDepth = o[0].XavatarCapsuleDepth; 1120 p.avatarCapsuleDepth = BSParam.AvatarCapsuleDepth;
1121 p.avatarCapsuleHeight = o[0].XavatarCapsuleHeight; 1121 p.avatarCapsuleHeight = BSParam.AvatarCapsuleHeight;
1122 p.avatarContactProcessingThreshold = o[0].XavatarContactProcessingThreshold; 1122 p.avatarContactProcessingThreshold = BSParam.AvatarContactProcessingThreshold;
1123 1123
1124 p.vehicleAngularDamping = o[0].XvehicleAngularDamping; 1124 p.vehicleAngularDamping = BSParam.VehicleAngularDamping;
1125 1125
1126 p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize; 1126 p.maxPersistantManifoldPoolSize = o[0].maxPersistantManifoldPoolSize;
1127 p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize; 1127 p.maxCollisionAlgorithmPoolSize = o[0].maxCollisionAlgorithmPoolSize;
@@ -1132,15 +1132,15 @@ private sealed class BulletConstraintXNA : BulletConstraint
1132 p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching; 1132 p.shouldEnableFrictionCaching = o[0].shouldEnableFrictionCaching;
1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations; 1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations;
1134 1134
1135 p.linksetImplementation = o[0].XlinksetImplementation; 1135 p.linksetImplementation = BSParam.LinksetImplementation;
1136 p.linkConstraintUseFrameOffset = o[0].XlinkConstraintUseFrameOffset; 1136 p.linkConstraintUseFrameOffset = BSParam.LinkConstraintUseFrameOffset;
1137 p.linkConstraintEnableTransMotor = o[0].XlinkConstraintEnableTransMotor; 1137 p.linkConstraintEnableTransMotor = BSParam.LinkConstraintEnableTransMotor;
1138 p.linkConstraintTransMotorMaxVel = o[0].XlinkConstraintTransMotorMaxVel; 1138 p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
1139 p.linkConstraintTransMotorMaxForce = o[0].XlinkConstraintTransMotorMaxForce; 1139 p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
1140 p.linkConstraintERP = o[0].XlinkConstraintERP; 1140 p.linkConstraintERP = BSParam.LinkConstraintERP;
1141 p.linkConstraintCFM = o[0].XlinkConstraintCFM; 1141 p.linkConstraintCFM = BSParam.LinkConstraintCFM;
1142 p.linkConstraintSolverIterations = o[0].XlinkConstraintSolverIterations; 1142 p.linkConstraintSolverIterations = BSParam.LinkConstraintSolverIterations;
1143 p.physicsLoggingFrames = o[0].XphysicsLoggingFrames; 1143 p.physicsLoggingFrames = o[0].physicsLoggingFrames;
1144 DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo(); 1144 DefaultCollisionConstructionInfo ccci = new DefaultCollisionConstructionInfo();
1145 1145
1146 DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration(); 1146 DefaultCollisionConfiguration cci = new DefaultCollisionConfiguration();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index abbd22c..5e06c1e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -174,32 +174,6 @@ public struct ConfigurationParameters
174 public float collisionMargin; 174 public float collisionMargin;
175 public float gravity; 175 public float gravity;
176 176
177 public float XlinearDamping;
178 public float XangularDamping;
179 public float XdeactivationTime;
180 public float XlinearSleepingThreshold;
181 public float XangularSleepingThreshold;
182 public float XccdMotionThreshold;
183 public float XccdSweptSphereRadius;
184 public float XcontactProcessingThreshold;
185
186 public float XterrainImplementation;
187 public float XterrainFriction;
188 public float XterrainHitFraction;
189 public float XterrainRestitution;
190 public float XterrainCollisionMargin;
191
192 public float XavatarFriction;
193 public float XavatarStandingFriction;
194 public float XavatarDensity;
195 public float XavatarRestitution;
196 public float XavatarCapsuleWidth;
197 public float XavatarCapsuleDepth;
198 public float XavatarCapsuleHeight;
199 public float XavatarContactProcessingThreshold;
200
201 public float XvehicleAngularDamping;
202
203 public float maxPersistantManifoldPoolSize; 177 public float maxPersistantManifoldPoolSize;
204 public float maxCollisionAlgorithmPoolSize; 178 public float maxCollisionAlgorithmPoolSize;
205 public float shouldDisableContactPoolDynamicAllocation; 179 public float shouldDisableContactPoolDynamicAllocation;
@@ -208,17 +182,9 @@ public struct ConfigurationParameters
208 public float shouldSplitSimulationIslands; 182 public float shouldSplitSimulationIslands;
209 public float shouldEnableFrictionCaching; 183 public float shouldEnableFrictionCaching;
210 public float numberOfSolverIterations; 184 public float numberOfSolverIterations;
185 public float useSingleSidedMeshes;
211 186
212 public float XlinksetImplementation; 187 public float physicsLoggingFrames;
213 public float XlinkConstraintUseFrameOffset;
214 public float XlinkConstraintEnableTransMotor;
215 public float XlinkConstraintTransMotorMaxVel;
216 public float XlinkConstraintTransMotorMaxForce;
217 public float XlinkConstraintERP;
218 public float XlinkConstraintCFM;
219 public float XlinkConstraintSolverIterations;
220
221 public float XphysicsLoggingFrames;
222 188
223 public const float numericTrue = 1f; 189 public const float numericTrue = 1f;
224 public const float numericFalse = 0f; 190 public const float numericFalse = 0f;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 8c098b2..fbef7e7 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -68,6 +68,24 @@ public static class BSParam
68 public static float TerrainRestitution { get; private set; } 68 public static float TerrainRestitution { get; private set; }
69 public static float TerrainCollisionMargin { get; private set; } 69 public static float TerrainCollisionMargin { get; private set; }
70 70
71 public static float DefaultFriction;
72 public static float DefaultDensity;
73 public static float DefaultRestitution;
74 public static float CollisionMargin;
75 public static float Gravity;
76
77 // Physics Engine operation
78 public static float MaxPersistantManifoldPoolSize;
79 public static float MaxCollisionAlgorithmPoolSize;
80 public static float ShouldDisableContactPoolDynamicAllocation;
81 public static float ShouldForceUpdateAllAabbs;
82 public static float ShouldRandomizeSolverOrder;
83 public static float ShouldSplitSimulationIslands;
84 public static float ShouldEnableFrictionCaching;
85 public static float NumberOfSolverIterations;
86 public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } }
87 public static float UseSingleSidedMeshesF;
88
71 // Avatar parameters 89 // Avatar parameters
72 public static float AvatarFriction { get; private set; } 90 public static float AvatarFriction { get; private set; }
73 public static float AvatarStandingFriction { get; private set; } 91 public static float AvatarStandingFriction { get; private set; }
@@ -287,29 +305,29 @@ public static class BSParam
287 305
288 new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 306 new ParameterDefn("DefaultFriction", "Friction factor used on new objects",
289 0.2f, 307 0.2f,
290 (s,cf,p,v) => { s.UnmanagedParams[0].defaultFriction = cf.GetFloat(p, v); }, 308 (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); },
291 (s) => { return s.UnmanagedParams[0].defaultFriction; }, 309 (s) => { return DefaultFriction; },
292 (s,p,l,v) => { s.UnmanagedParams[0].defaultFriction = v; } ), 310 (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
293 new ParameterDefn("DefaultDensity", "Density for new objects" , 311 new ParameterDefn("DefaultDensity", "Density for new objects" ,
294 10.000006836f, // Aluminum g/cm3 312 10.000006836f, // Aluminum g/cm3
295 (s,cf,p,v) => { s.UnmanagedParams[0].defaultDensity = cf.GetFloat(p, v); }, 313 (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); },
296 (s) => { return s.UnmanagedParams[0].defaultDensity; }, 314 (s) => { return DefaultDensity; },
297 (s,p,l,v) => { s.UnmanagedParams[0].defaultDensity = v; } ), 315 (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
298 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , 316 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" ,
299 0f, 317 0f,
300 (s,cf,p,v) => { s.UnmanagedParams[0].defaultRestitution = cf.GetFloat(p, v); }, 318 (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); },
301 (s) => { return s.UnmanagedParams[0].defaultRestitution; }, 319 (s) => { return DefaultRestitution; },
302 (s,p,l,v) => { s.UnmanagedParams[0].defaultRestitution = v; } ), 320 (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ),
303 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", 321 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)",
304 0.04f, 322 0.04f,
305 (s,cf,p,v) => { s.UnmanagedParams[0].collisionMargin = cf.GetFloat(p, v); }, 323 (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); },
306 (s) => { return s.UnmanagedParams[0].collisionMargin; }, 324 (s) => { return CollisionMargin; },
307 (s,p,l,v) => { s.UnmanagedParams[0].collisionMargin = v; } ), 325 (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ),
308 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", 326 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)",
309 -9.80665f, 327 -9.80665f,
310 (s,cf,p,v) => { s.UnmanagedParams[0].gravity = cf.GetFloat(p, v); }, 328 (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); },
311 (s) => { return s.UnmanagedParams[0].gravity; }, 329 (s) => { return Gravity; },
312 (s,p,l,v) => { s.UpdateParameterObject((x)=>{s.UnmanagedParams[0].gravity=x;}, p, PhysParameterEntry.APPLY_TO_NONE, v); }, 330 (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; },
313 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), 331 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ),
314 332
315 333
@@ -317,49 +335,49 @@ public static class BSParam
317 0f, 335 0f,
318 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); }, 336 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); },
319 (s) => { return LinearDamping; }, 337 (s) => { return LinearDamping; },
320 (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearDamping=x;}, p, l, v); }, 338 (s,p,l,v) => { LinearDamping = v; },
321 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), 339 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ),
322 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 340 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)",
323 0f, 341 0f,
324 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); }, 342 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); },
325 (s) => { return AngularDamping; }, 343 (s) => { return AngularDamping; },
326 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularDamping=x;}, p, l, v); }, 344 (s,p,l,v) => { AngularDamping = v; },
327 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), 345 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ),
328 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 346 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static",
329 0.2f, 347 0.2f,
330 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); }, 348 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); },
331 (s) => { return DeactivationTime; }, 349 (s) => { return DeactivationTime; },
332 (s,p,l,v) => { s.UpdateParameterObject((x)=>{DeactivationTime=x;}, p, l, v); }, 350 (s,p,l,v) => { DeactivationTime = v; },
333 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), 351 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ),
334 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 352 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
335 0.8f, 353 0.8f,
336 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); }, 354 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); },
337 (s) => { return LinearSleepingThreshold; }, 355 (s) => { return LinearSleepingThreshold; },
338 (s,p,l,v) => { s.UpdateParameterObject((x)=>{LinearSleepingThreshold=x;}, p, l, v); }, 356 (s,p,l,v) => { LinearSleepingThreshold = v;},
339 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 357 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
340 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 358 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static",
341 1.0f, 359 1.0f,
342 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); }, 360 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); },
343 (s) => { return AngularSleepingThreshold; }, 361 (s) => { return AngularSleepingThreshold; },
344 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AngularSleepingThreshold=x;}, p, l, v); }, 362 (s,p,l,v) => { AngularSleepingThreshold = v;},
345 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 363 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ),
346 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 364 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
347 0.0f, // set to zero to disable 365 0.0f, // set to zero to disable
348 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); }, 366 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
349 (s) => { return CcdMotionThreshold; }, 367 (s) => { return CcdMotionThreshold; },
350 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdMotionThreshold=x;}, p, l, v); }, 368 (s,p,l,v) => { CcdMotionThreshold = v;},
351 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), 369 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ),
352 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 370 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
353 0.2f, 371 0.2f,
354 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); }, 372 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
355 (s) => { return CcdSweptSphereRadius; }, 373 (s) => { return CcdSweptSphereRadius; },
356 (s,p,l,v) => { s.UpdateParameterObject((x)=>{CcdSweptSphereRadius=x;}, p, l, v); }, 374 (s,p,l,v) => { CcdSweptSphereRadius = v;},
357 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), 375 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ),
358 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , 376 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" ,
359 0.0f, 377 0.0f,
360 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); }, 378 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); },
361 (s) => { return ContactProcessingThreshold; }, 379 (s) => { return ContactProcessingThreshold; },
362 (s,p,l,v) => { s.UpdateParameterObject((x)=>{ContactProcessingThreshold=x;}, p, l, v); }, 380 (s,p,l,v) => { ContactProcessingThreshold = v;},
363 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), 381 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ),
364 382
365 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 383 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
@@ -392,7 +410,7 @@ public static class BSParam
392 0.2f, 410 0.2f,
393 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); }, 411 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); },
394 (s) => { return AvatarFriction; }, 412 (s) => { return AvatarFriction; },
395 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarFriction=x;}, p, l, v); } ), 413 (s,p,l,v) => { AvatarFriction = v; } ),
396 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 414 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
397 10.0f, 415 10.0f,
398 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, 416 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); },
@@ -407,32 +425,32 @@ public static class BSParam
407 3.5f, 425 3.5f,
408 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, 426 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); },
409 (s) => { return AvatarDensity; }, 427 (s) => { return AvatarDensity; },
410 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarDensity=x;}, p, l, v); } ), 428 (s,p,l,v) => { AvatarDensity = v; } ),
411 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 429 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
412 0f, 430 0f,
413 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); }, 431 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); },
414 (s) => { return AvatarRestitution; }, 432 (s) => { return AvatarRestitution; },
415 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarRestitution=x;}, p, l, v); } ), 433 (s,p,l,v) => { AvatarRestitution = v; } ),
416 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 434 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
417 0.6f, 435 0.6f,
418 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); }, 436 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); },
419 (s) => { return AvatarCapsuleWidth; }, 437 (s) => { return AvatarCapsuleWidth; },
420 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleWidth=x;}, p, l, v); } ), 438 (s,p,l,v) => { AvatarCapsuleWidth = v; } ),
421 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 439 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
422 0.45f, 440 0.45f,
423 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); }, 441 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); },
424 (s) => { return AvatarCapsuleDepth; }, 442 (s) => { return AvatarCapsuleDepth; },
425 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleDepth=x;}, p, l, v); } ), 443 (s,p,l,v) => { AvatarCapsuleDepth = v; } ),
426 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 444 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar",
427 1.5f, 445 1.5f,
428 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); }, 446 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); },
429 (s) => { return AvatarCapsuleHeight; }, 447 (s) => { return AvatarCapsuleHeight; },
430 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarCapsuleHeight=x;}, p, l, v); } ), 448 (s,p,l,v) => { AvatarCapsuleHeight = v; } ),
431 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 449 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
432 0.1f, 450 0.1f,
433 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); }, 451 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); },
434 (s) => { return AvatarContactProcessingThreshold; }, 452 (s) => { return AvatarContactProcessingThreshold; },
435 (s,p,l,v) => { s.UpdateParameterObject((x)=>{AvatarContactProcessingThreshold=x;}, p, l, v); } ), 453 (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ),
436 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 454 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction",
437 0.3f, 455 0.3f,
438 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); }, 456 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); },
@@ -497,44 +515,49 @@ public static class BSParam
497 515
498 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 516 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
499 0f, 517 0f,
500 (s,cf,p,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = cf.GetFloat(p, v); }, 518 (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
501 (s) => { return s.UnmanagedParams[0].maxPersistantManifoldPoolSize; }, 519 (s) => { return MaxPersistantManifoldPoolSize; },
502 (s,p,l,v) => { s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), 520 (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ),
503 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", 521 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
504 0f, 522 0f,
505 (s,cf,p,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); }, 523 (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); },
506 (s) => { return s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize; }, 524 (s) => { return MaxCollisionAlgorithmPoolSize; },
507 (s,p,l,v) => { s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), 525 (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ),
508 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", 526 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
509 ConfigurationParameters.numericFalse, 527 ConfigurationParameters.numericFalse,
510 (s,cf,p,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 528 (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
511 (s) => { return s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation; }, 529 (s) => { return ShouldDisableContactPoolDynamicAllocation; },
512 (s,p,l,v) => { s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), 530 (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ),
513 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", 531 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
514 ConfigurationParameters.numericFalse, 532 ConfigurationParameters.numericFalse,
515 (s,cf,p,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 533 (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
516 (s) => { return s.UnmanagedParams[0].shouldForceUpdateAllAabbs; }, 534 (s) => { return ShouldForceUpdateAllAabbs; },
517 (s,p,l,v) => { s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), 535 (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ),
518 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", 536 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
519 ConfigurationParameters.numericTrue, 537 ConfigurationParameters.numericTrue,
520 (s,cf,p,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 538 (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
521 (s) => { return s.UnmanagedParams[0].shouldRandomizeSolverOrder; }, 539 (s) => { return ShouldRandomizeSolverOrder; },
522 (s,p,l,v) => { s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), 540 (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ),
523 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", 541 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
524 ConfigurationParameters.numericTrue, 542 ConfigurationParameters.numericTrue,
525 (s,cf,p,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 543 (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
526 (s) => { return s.UnmanagedParams[0].shouldSplitSimulationIslands; }, 544 (s) => { return ShouldSplitSimulationIslands; },
527 (s,p,l,v) => { s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), 545 (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ),
528 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", 546 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching",
529 ConfigurationParameters.numericTrue, 547 ConfigurationParameters.numericTrue,
530 (s,cf,p,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 548 (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
531 (s) => { return s.UnmanagedParams[0].shouldEnableFrictionCaching; }, 549 (s) => { return ShouldEnableFrictionCaching; },
532 (s,p,l,v) => { s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), 550 (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ),
533 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", 551 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
534 0f, // zero says use Bullet default 552 0f, // zero says use Bullet default
535 (s,cf,p,v) => { s.UnmanagedParams[0].numberOfSolverIterations = cf.GetFloat(p, v); }, 553 (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); },
536 (s) => { return s.UnmanagedParams[0].numberOfSolverIterations; }, 554 (s) => { return NumberOfSolverIterations; },
537 (s,p,l,v) => { s.UnmanagedParams[0].numberOfSolverIterations = v; } ), 555 (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ),
556 new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.",
557 ConfigurationParameters.numericTrue,
558 (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
559 (s) => { return UseSingleSidedMeshesF; },
560 (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ),
538 561
539 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 562 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
540 (float)BSLinkset.LinksetImplementation.Compound, 563 (float)BSLinkset.LinksetImplementation.Compound,
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index a4690ba..6cd72f2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -882,41 +882,41 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
882 BSParam.ParameterDefn theParam; 882 BSParam.ParameterDefn theParam;
883 if (BSParam.TryGetParameter(parm, out theParam)) 883 if (BSParam.TryGetParameter(parm, out theParam))
884 { 884 {
885 // Set the value in the C# code
885 theParam.setter(this, parm, localID, val); 886 theParam.setter(this, parm, localID, val);
887
888 // Optionally set the parameter in the unmanaged code
889 if (theParam.onObject != null)
890 {
891 // update all the localIDs specified
892 // If the local ID is APPLY_TO_NONE, just change the default value
893 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
894 // If the localID is a specific object, apply the parameter change to only that object
895 List<uint> objectIDs = new List<uint>();
896 switch (localID)
897 {
898 case PhysParameterEntry.APPLY_TO_NONE:
899 // This will cause a call into the physical world if some operation is specified (SetOnObject).
900 objectIDs.Add(TERRAIN_ID);
901 TaintedUpdateParameter(parm, objectIDs, val);
902 break;
903 case PhysParameterEntry.APPLY_TO_ALL:
904 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
905 TaintedUpdateParameter(parm, objectIDs, val);
906 break;
907 default:
908 // setting only one localID
909 objectIDs.Add(localID);
910 TaintedUpdateParameter(parm, objectIDs, val);
911 break;
912 }
913 }
914
886 ret = true; 915 ret = true;
887 } 916 }
888 return ret; 917 return ret;
889 } 918 }
890 919
891 // update all the localIDs specified
892 // If the local ID is APPLY_TO_NONE, just change the default value
893 // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs
894 // If the localID is a specific object, apply the parameter change to only that object
895 internal delegate void AssignVal(float x);
896 internal void UpdateParameterObject(AssignVal setDefault, string parm, uint localID, float val)
897 {
898 List<uint> objectIDs = new List<uint>();
899 switch (localID)
900 {
901 case PhysParameterEntry.APPLY_TO_NONE:
902 setDefault(val); // setting only the default value
903 // This will cause a call into the physical world if some operation is specified (SetOnObject).
904 objectIDs.Add(TERRAIN_ID);
905 TaintedUpdateParameter(parm, objectIDs, val);
906 break;
907 case PhysParameterEntry.APPLY_TO_ALL:
908 setDefault(val); // setting ALL also sets the default value
909 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
910 TaintedUpdateParameter(parm, objectIDs, val);
911 break;
912 default:
913 // setting only one localID
914 objectIDs.Add(localID);
915 TaintedUpdateParameter(parm, objectIDs, val);
916 break;
917 }
918 }
919
920 // schedule the actual updating of the paramter to when the phys engine is not busy 920 // schedule the actual updating of the paramter to when the phys engine is not busy
921 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 921 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val)
922 { 922 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
index 8244f02..d7e800d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -96,7 +96,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
96 { 96 {
97 // DISASTER!! 97 // DISASTER!!
98 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID); 98 PhysicsScene.DetailLog("{0},BSTerrainMesh.create,failedCreationOfShape", ID);
99 physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase); 99 PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain mesh! base={1}", LogHeader, TerrainBase);
100 // Something is very messed up and a crash is in our future. 100 // Something is very messed up and a crash is in our future.
101 return; 101 return;
102 } 102 }
@@ -108,7 +108,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
108 if (!m_terrainBody.HasPhysicalBody) 108 if (!m_terrainBody.HasPhysicalBody)
109 { 109 {
110 // DISASTER!! 110 // DISASTER!!
111 physicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase); 111 PhysicsScene.Logger.ErrorFormat("{0} Failed creation of terrain body! base={1}", LogHeader, TerrainBase);
112 // Something is very messed up and a crash is in our future. 112 // Something is very messed up and a crash is in our future.
113 return; 113 return;
114 } 114 }
@@ -131,6 +131,12 @@ public sealed class BSTerrainMesh : BSTerrainPhys
131 m_terrainBody.collisionType = CollisionType.Terrain; 131 m_terrainBody.collisionType = CollisionType.Terrain;
132 m_terrainBody.ApplyCollisionMask(PhysicsScene); 132 m_terrainBody.ApplyCollisionMask(PhysicsScene);
133 133
134 if (BSParam.UseSingleSidedMeshes)
135 {
136 PhysicsScene.DetailLog("{0},BSTerrainMesh.settingCustomMaterial", id);
137 PhysicsScene.PE.AddToCollisionFlags(m_terrainBody, CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
138 }
139
134 // Make it so the terrain will not move or be considered for movement. 140 // Make it so the terrain will not move or be considered for movement.
135 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION); 141 PhysicsScene.PE.ForceActivationState(m_terrainBody, ActivationState.DISABLE_SIMULATION);
136 } 142 }
@@ -176,8 +182,7 @@ public sealed class BSTerrainMesh : BSTerrainPhys
176 182
177 // Convert the passed heightmap to mesh information suitable for CreateMeshShape2(). 183 // Convert the passed heightmap to mesh information suitable for CreateMeshShape2().
178 // Return 'true' if successfully created. 184 // Return 'true' if successfully created.
179 public static bool ConvertHeightmapToMesh( 185 public static bool ConvertHeightmapToMesh( BSScene physicsScene,
180 BSScene physicsScene,
181 float[] heightMap, int sizeX, int sizeY, // parameters of incoming heightmap 186 float[] heightMap, int sizeX, int sizeY, // parameters of incoming heightmap
182 float extentX, float extentY, // zero based range for output vertices 187 float extentX, float extentY, // zero based range for output vertices
183 Vector3 extentBase, // base to be added to all vertices 188 Vector3 extentBase, // base to be added to all vertices