aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSParam.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs340
1 files changed, 180 insertions, 160 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 385ed9e..4520171 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27using System; 27using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
29using System.Text; 30using System.Text;
30 31
31using OpenSim.Region.Physics.Manager; 32using OpenSim.Region.Physics.Manager;
@@ -37,7 +38,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
37{ 38{
38public static class BSParam 39public static class BSParam
39{ 40{
40 private static string LogHeader = "[BULLETSIM PARAMETERS]"; 41 private static string LogHeader = "[BULLETSIM PARAMETERS]";
41 42
42 // Tuning notes: 43 // Tuning notes:
43 // From: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6575 44 // From: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=6575
@@ -51,7 +52,10 @@ public static class BSParam
51 // This is separate/independent from the collision margin. The collision margin increases the object a bit 52 // This is separate/independent from the collision margin. The collision margin increases the object a bit
52 // to improve collision detection performance and accuracy. 53 // to improve collision detection performance and accuracy.
53 // =================== 54 // ===================
54 // From: 55 // From:
56
57 public static bool UseSeparatePhysicsThread { get; private set; }
58 public static float PhysicsTimeStep { get; private set; }
55 59
56 // Level of Detail values kept as float because that's what the Meshmerizer wants 60 // Level of Detail values kept as float because that's what the Meshmerizer wants
57 public static float MeshLOD { get; private set; } 61 public static float MeshLOD { get; private set; }
@@ -86,8 +90,12 @@ public static class BSParam
86 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes 90 public static bool ShouldForceSimplePrimMeshing { get; private set; } // if a cube or sphere, let Bullet do internal shapes
87 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects 91 public static bool ShouldUseHullsForPhysicalObjects { get; private set; } // 'true' if should create hulls for physical objects
88 public static bool ShouldRemoveZeroWidthTriangles { get; private set; } 92 public static bool ShouldRemoveZeroWidthTriangles { get; private set; }
93 public static bool ShouldUseBulletHACD { get; set; }
94 public static bool ShouldUseSingleConvexHullForPrims { get; set; }
95 public static bool ShouldUseGImpactShapeForPrims { get; set; }
96 public static bool ShouldUseAssetHulls { get; set; }
89 97
90 public static float TerrainImplementation { get; private set; } 98 public static float TerrainImplementation { get; set; }
91 public static int TerrainMeshMagnification { get; private set; } 99 public static int TerrainMeshMagnification { get; private set; }
92 public static float TerrainFriction { get; private set; } 100 public static float TerrainFriction { get; private set; }
93 public static float TerrainHitFraction { get; private set; } 101 public static float TerrainHitFraction { get; private set; }
@@ -122,11 +130,17 @@ public static class BSParam
122 public static float AvatarCapsuleWidth { get; private set; } 130 public static float AvatarCapsuleWidth { get; private set; }
123 public static float AvatarCapsuleDepth { get; private set; } 131 public static float AvatarCapsuleDepth { get; private set; }
124 public static float AvatarCapsuleHeight { get; private set; } 132 public static float AvatarCapsuleHeight { get; private set; }
133 public static float AvatarHeightLowFudge { get; private set; }
134 public static float AvatarHeightMidFudge { get; private set; }
135 public static float AvatarHeightHighFudge { get; private set; }
125 public static float AvatarContactProcessingThreshold { get; private set; } 136 public static float AvatarContactProcessingThreshold { get; private set; }
137 public static int AvatarJumpFrames { get; private set; }
126 public static float AvatarBelowGroundUpCorrectionMeters { get; private set; } 138 public static float AvatarBelowGroundUpCorrectionMeters { get; private set; }
127 public static float AvatarStepHeight { get; private set; } 139 public static float AvatarStepHeight { get; private set; }
128 public static float AvatarStepApproachFactor { get; private set; } 140 public static float AvatarStepApproachFactor { get; private set; }
129 public static float AvatarStepForceFactor { get; private set; } 141 public static float AvatarStepForceFactor { get; private set; }
142 public static float AvatarStepUpCorrectionFactor { get; private set; }
143 public static int AvatarStepSmoothingSteps { get; private set; }
130 144
131 // Vehicle parameters 145 // Vehicle parameters
132 public static float VehicleMaxLinearVelocity { get; private set; } 146 public static float VehicleMaxLinearVelocity { get; private set; }
@@ -138,9 +152,15 @@ public static class BSParam
138 public static float VehicleRestitution { get; private set; } 152 public static float VehicleRestitution { get; private set; }
139 public static Vector3 VehicleLinearFactor { get; private set; } 153 public static Vector3 VehicleLinearFactor { get; private set; }
140 public static Vector3 VehicleAngularFactor { get; private set; } 154 public static Vector3 VehicleAngularFactor { get; private set; }
155 public static Vector3 VehicleInertiaFactor { get; private set; }
141 public static float VehicleGroundGravityFudge { get; private set; } 156 public static float VehicleGroundGravityFudge { get; private set; }
142 public static float VehicleAngularBankingTimescaleFudge { get; private set; } 157 public static float VehicleAngularBankingTimescaleFudge { get; private set; }
143 public static bool VehicleDebuggingEnabled { get; private set; } 158 public static bool VehicleEnableLinearDeflection { get; private set; }
159 public static bool VehicleLinearDeflectionNotCollidingNoZ { get; private set; }
160 public static bool VehicleEnableAngularVerticalAttraction { get; private set; }
161 public static int VehicleAngularVerticalAttractionAlgorithm { get; private set; }
162 public static bool VehicleEnableAngularDeflection { get; private set; }
163 public static bool VehicleEnableAngularBanking { get; private set; }
144 164
145 // Convex Hulls 165 // Convex Hulls
146 public static int CSHullMaxDepthSplit { get; private set; } 166 public static int CSHullMaxDepthSplit { get; private set; }
@@ -149,9 +169,19 @@ public static class BSParam
149 public static float CSHullVolumeConservationThresholdPercent { get; private set; } 169 public static float CSHullVolumeConservationThresholdPercent { get; private set; }
150 public static int CSHullMaxVertices { get; private set; } 170 public static int CSHullMaxVertices { get; private set; }
151 public static float CSHullMaxSkinWidth { get; private set; } 171 public static float CSHullMaxSkinWidth { get; private set; }
172 public static float BHullMaxVerticesPerHull { get; private set; } // 100
173 public static float BHullMinClusters { get; private set; } // 2
174 public static float BHullCompacityWeight { get; private set; } // 0.1
175 public static float BHullVolumeWeight { get; private set; } // 0.0
176 public static float BHullConcavity { get; private set; } // 100
177 public static bool BHullAddExtraDistPoints { get; private set; } // false
178 public static bool BHullAddNeighboursDistPoints { get; private set; } // false
179 public static bool BHullAddFacesPoints { get; private set; } // false
180 public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false
152 181
153 // Linkset implementation parameters 182 // Linkset implementation parameters
154 public static float LinksetImplementation { get; private set; } 183 public static float LinksetImplementation { get; private set; }
184 public static bool LinksetOffsetCenterOfMass { get; private set; }
155 public static bool LinkConstraintUseFrameOffset { get; private set; } 185 public static bool LinkConstraintUseFrameOffset { get; private set; }
156 public static bool LinkConstraintEnableTransMotor { get; private set; } 186 public static bool LinkConstraintEnableTransMotor { get; private set; }
157 public static float LinkConstraintTransMotorMaxVel { get; private set; } 187 public static float LinkConstraintTransMotorMaxVel { get; private set; }
@@ -223,16 +253,41 @@ public static class BSParam
223 getter = pGetter; 253 getter = pGetter;
224 objectSet = pObjSetter; 254 objectSet = pObjSetter;
225 } 255 }
226 /* Wish I could simplify using this definition but CLR doesn't store references so closure around delegates of references won't work 256 // Simple parameter variable where property name is the same as the INI file name
227 public ParameterDefn(string pName, string pDesc, T pDefault, ref T loc) 257 // and the value is only a simple get and set.
258 public ParameterDefn(string pName, string pDesc, T pDefault)
228 : base(pName, pDesc) 259 : base(pName, pDesc)
229 { 260 {
230 defaultValue = pDefault; 261 defaultValue = pDefault;
231 setter = (s, v) => { loc = v; }; 262 setter = (s, v) => { SetValueByName(s, name, v); };
232 getter = (s) => { return loc; }; 263 getter = (s) => { return GetValueByName(s, name); };
233 objectSet = null; 264 objectSet = null;
234 } 265 }
235 */ 266 // Use reflection to find the property named 'pName' in BSParam and assign 'val' to same.
267 private void SetValueByName(BSScene s, string pName, T val)
268 {
269 PropertyInfo prop = typeof(BSParam).GetProperty(pName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
270 if (prop == null)
271 {
272 // This should only be output when someone adds a new INI parameter and misspells the name.
273 s.Logger.ErrorFormat("{0} SetValueByName: did not find '{1}'. Verify specified property name is the same as the given INI parameters name.", LogHeader, pName);
274 }
275 else
276 {
277 prop.SetValue(null, val, null);
278 }
279 }
280 // Use reflection to find the property named 'pName' in BSParam and return the value in same.
281 private T GetValueByName(BSScene s, string pName)
282 {
283 PropertyInfo prop = typeof(BSParam).GetProperty(pName, BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
284 if (prop == null)
285 {
286 // This should only be output when someone adds a new INI parameter and misspells the name.
287 s.Logger.ErrorFormat("{0} GetValueByName: did not find '{1}'. Verify specified property name is the same as the given INI parameter name.", LogHeader, pName);
288 }
289 return (T)prop.GetValue(null, null);
290 }
236 public override void AssignDefault(BSScene s) 291 public override void AssignDefault(BSScene s)
237 { 292 {
238 setter(s, defaultValue); 293 setter(s, defaultValue);
@@ -309,6 +364,11 @@ public static class BSParam
309 // v = value (appropriate type) 364 // v = value (appropriate type)
310 private static ParameterDefnBase[] ParameterDefinitions = 365 private static ParameterDefnBase[] ParameterDefinitions =
311 { 366 {
367 new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat",
368 false ),
369 new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval",
370 0.089f ),
371
312 new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties", 372 new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties",
313 true, 373 true,
314 (s) => { return ShouldMeshSculptedPrim; }, 374 (s) => { return ShouldMeshSculptedPrim; },
@@ -322,18 +382,20 @@ public static class BSParam
322 (s) => { return ShouldUseHullsForPhysicalObjects; }, 382 (s) => { return ShouldUseHullsForPhysicalObjects; },
323 (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ), 383 (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ),
324 new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", 384 new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
325 true, 385 true ),
326 (s) => { return ShouldRemoveZeroWidthTriangles; }, 386 new ParameterDefn<bool>("ShouldUseBulletHACD", "If true, use the Bullet version of HACD",
327 (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ), 387 false ),
388 new ParameterDefn<bool>("ShouldUseSingleConvexHullForPrims", "If true, use a single convex hull shape for physical prims",
389 true ),
390 new ParameterDefn<bool>("ShouldUseGImpactShapeForPrims", "If true, use a GImpact shape for prims with cuts and twists",
391 false ),
392 new ParameterDefn<bool>("ShouldUseAssetHulls", "If true, use hull if specified in the mesh asset info",
393 true ),
328 394
329 new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions", 395 new ParameterDefn<int>("CrossingFailuresBeforeOutOfBounds", "How forgiving we are about getting into adjactent regions",
330 5, 396 5 ),
331 (s) => { return CrossingFailuresBeforeOutOfBounds; },
332 (s,v) => { CrossingFailuresBeforeOutOfBounds = v; } ),
333 new ParameterDefn<float>("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator", 397 new ParameterDefn<float>("UpdateVelocityChangeThreshold", "Change in updated velocity required before reporting change to simulator",
334 0.1f, 398 0.1f ),
335 (s) => { return UpdateVelocityChangeThreshold; },
336 (s,v) => { UpdateVelocityChangeThreshold = v; } ),
337 399
338 new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)", 400 new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
339 32f, 401 32f,
@@ -399,26 +461,22 @@ public static class BSParam
399 (s) => { return MaxAddForceMagnitude; }, 461 (s) => { return MaxAddForceMagnitude; },
400 (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ), 462 (s,v) => { MaxAddForceMagnitude = v; MaxAddForceMagnitudeSquared = v * v; } ),
401 // Density is passed around as 100kg/m3. This scales that to 1kg/m3. 463 // Density is passed around as 100kg/m3. This scales that to 1kg/m3.
464 // Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well
402 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", 465 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
403 0.01f, 466 0.01f ),
404 (s) => { return DensityScaleFactor; },
405 (s,v) => { DensityScaleFactor = v; } ),
406 467
407 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing", 468 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing",
408 2200f, 469 2200f ),
409 (s) => { return (float)PID_D; },
410 (s,v) => { PID_D = v; } ),
411 new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing", 470 new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing",
412 900f, 471 900f ),
413 (s) => { return (float)PID_P; },
414 (s,v) => { PID_P = v; } ),
415 472
416 new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects", 473 new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects",
417 0.2f, 474 0.2f,
418 (s) => { return DefaultFriction; }, 475 (s) => { return DefaultFriction; },
419 (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), 476 (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
477 // For historical reasons, the viewer and simulator multiply the density by 100
420 new ParameterDefn<float>("DefaultDensity", "Density for new objects" , 478 new ParameterDefn<float>("DefaultDensity", "Density for new objects" ,
421 10.000006836f, // Aluminum g/cm3 479 1000.0006836f, // Aluminum g/cm3 * 100
422 (s) => { return DefaultDensity; }, 480 (s) => { return DefaultDensity; },
423 (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), 481 (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
424 new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" , 482 new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" ,
@@ -478,86 +536,59 @@ public static class BSParam
478 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), 536 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
479 537
480 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 538 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
481 (float)BSTerrainPhys.TerrainImplementation.Mesh, 539 (float)BSTerrainPhys.TerrainImplementation.Mesh ),
482 (s) => { return TerrainImplementation; },
483 (s,v) => { TerrainImplementation = v; } ),
484 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 540 new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
485 2, 541 2 ),
486 (s) => { return TerrainMeshMagnification; },
487 (s,v) => { TerrainMeshMagnification = v; } ),
488 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" , 542 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" ,
489 0.3f, 543 0.3f ),
490 (s) => { return TerrainFriction; },
491 (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ),
492 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" , 544 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" ,
493 0.8f, 545 0.8f ),
494 (s) => { return TerrainHitFraction; },
495 (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ),
496 new ParameterDefn<float>("TerrainRestitution", "Bouncyness" , 546 new ParameterDefn<float>("TerrainRestitution", "Bouncyness" ,
497 0f, 547 0f ),
498 (s) => { return TerrainRestitution; },
499 (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ),
500 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" , 548 new ParameterDefn<float>("TerrainContactProcessingThreshold", "Distance from terrain to stop processing collisions" ,
501 0.0f, 549 0.0f ),
502 (s) => { return TerrainContactProcessingThreshold; },
503 (s,v) => { TerrainContactProcessingThreshold = v; /* TODO: set on real terrain */ } ),
504 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" , 550 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" ,
505 0.08f, 551 0.08f ),
506 (s) => { return TerrainCollisionMargin; },
507 (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ),
508 552
509 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 553 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.",
510 0.2f, 554 0.2f ),
511 (s) => { return AvatarFriction; },
512 (s,v) => { AvatarFriction = v; } ),
513 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 555 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
514 0.95f, 556 0.95f ),
515 (s) => { return AvatarStandingFriction; },
516 (s,v) => { AvatarStandingFriction = v; } ),
517 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 557 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
518 1.3f, 558 1.3f ),
519 (s) => { return AvatarAlwaysRunFactor; }, 559 // For historical reasons, density is reported * 100
520 (s,v) => { AvatarAlwaysRunFactor = v; } ), 560 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation. Scaled times 100.",
521 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 561 3500f) , // 3.5 * 100
522 3.5f,
523 (s) => { return AvatarDensity; },
524 (s,v) => { AvatarDensity = v; } ),
525 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 562 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
526 0f, 563 0f ),
527 (s) => { return AvatarRestitution; },
528 (s,v) => { AvatarRestitution = v; } ),
529 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 564 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
530 0.6f, 565 0.6f ) ,
531 (s) => { return AvatarCapsuleWidth; },
532 (s,v) => { AvatarCapsuleWidth = v; } ),
533 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 566 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
534 0.45f, 567 0.45f ),
535 (s) => { return AvatarCapsuleDepth; },
536 (s,v) => { AvatarCapsuleDepth = v; } ),
537 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar", 568 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar",
538 1.5f, 569 1.5f ),
539 (s) => { return AvatarCapsuleHeight; }, 570 new ParameterDefn<float>("AvatarHeightLowFudge", "A fudge factor to make small avatars stand on the ground",
540 (s,v) => { AvatarCapsuleHeight = v; } ), 571 -0.2f ),
572 new ParameterDefn<float>("AvatarHeightMidFudge", "A fudge distance to adjust average sized avatars to be standing on ground",
573 0.1f ),
574 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
575 0.1f ),
541 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 576 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
542 0.1f, 577 0.1f ),
543 (s) => { return AvatarContactProcessingThreshold; },
544 (s,v) => { AvatarContactProcessingThreshold = v; } ),
545 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground", 578 new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
546 1.0f, 579 1.0f ),
547 (s) => { return AvatarBelowGroundUpCorrectionMeters; }, 580 new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.",
548 (s,v) => { AvatarBelowGroundUpCorrectionMeters = v; } ), 581 4 ),
549 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction", 582 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
550 0.3f, 583 0.6f ) ,
551 (s) => { return AvatarStepHeight; },
552 (s,v) => { AvatarStepHeight = v; } ),
553 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", 584 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
554 0.6f, 585 0.6f ),
555 (s) => { return AvatarStepApproachFactor; },
556 (s,v) => { AvatarStepApproachFactor = v; } ),
557 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 586 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
558 2.0f, 587 1.0f ),
559 (s) => { return AvatarStepForceFactor; }, 588 new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
560 (s,v) => { AvatarStepForceFactor = v; } ), 589 1.0f ),
590 new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
591 2 ),
561 592
562 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 593 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
563 1000.0f, 594 1000.0f,
@@ -568,37 +599,33 @@ public static class BSParam
568 (s) => { return (float)VehicleMaxAngularVelocity; }, 599 (s) => { return (float)VehicleMaxAngularVelocity; },
569 (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), 600 (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ),
570 new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 601 new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)",
571 0.0f, 602 0.0f ),
572 (s) => { return VehicleAngularDamping; },
573 (s,v) => { VehicleAngularDamping = v; } ),
574 new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)", 603 new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)",
575 new Vector3(1f, 1f, 1f), 604 new Vector3(1f, 1f, 1f) ),
576 (s) => { return VehicleLinearFactor; },
577 (s,v) => { VehicleLinearFactor = v; } ),
578 new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)", 605 new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)",
579 new Vector3(1f, 1f, 1f), 606 new Vector3(1f, 1f, 1f) ),
580 (s) => { return VehicleAngularFactor; }, 607 new ParameterDefn<Vector3>("VehicleInertiaFactor", "Fraction of physical inertia applied (<0,0,0> to <1,1,1>)",
581 (s,v) => { VehicleAngularFactor = v; } ), 608 new Vector3(1f, 1f, 1f) ),
582 new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", 609 new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)",
583 0.0f, 610 0.0f ),
584 (s) => { return VehicleFriction; },
585 (s,v) => { VehicleFriction = v; } ),
586 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 611 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
587 0.0f, 612 0.0f ),
588 (s) => { return VehicleRestitution; },
589 (s,v) => { VehicleRestitution = v; } ),
590 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", 613 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
591 0.2f, 614 0.2f ),
592 (s) => { return VehicleGroundGravityFudge; },
593 (s,v) => { VehicleGroundGravityFudge = v; } ),
594 new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.", 615 new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
595 60.0f, 616 60.0f ),
596 (s) => { return VehicleAngularBankingTimescaleFudge; }, 617 new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect",
597 (s,v) => { VehicleAngularBankingTimescaleFudge = v; } ), 618 true ),
598 new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging", 619 new ParameterDefn<bool>("VehicleLinearDeflectionNotCollidingNoZ", "Turn on/off linear deflection Z effect on non-colliding vehicles",
599 false, 620 true ),
600 (s) => { return VehicleDebuggingEnabled; }, 621 new ParameterDefn<bool>("VehicleEnableAngularVerticalAttraction", "Turn on/off vehicle angular vertical attraction effect",
601 (s,v) => { VehicleDebuggingEnabled = v; } ), 622 true ),
623 new ParameterDefn<int>("VehicleAngularVerticalAttractionAlgorithm", "Select vertical attraction algo. You need to look at the source.",
624 0 ),
625 new ParameterDefn<bool>("VehicleEnableAngularDeflection", "Turn on/off vehicle angular deflection effect",
626 true ),
627 new ParameterDefn<bool>("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect",
628 true ),
602 629
603 new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 630 new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
604 0f, 631 0f,
@@ -611,7 +638,7 @@ public static class BSParam
611 new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", 638 new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
612 false, 639 false,
613 (s) => { return ShouldDisableContactPoolDynamicAllocation; }, 640 (s) => { return ShouldDisableContactPoolDynamicAllocation; },
614 (s,v) => { ShouldDisableContactPoolDynamicAllocation = v; 641 (s,v) => { ShouldDisableContactPoolDynamicAllocation = v;
615 s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ), 642 s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ),
616 new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", 643 new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
617 false, 644 false,
@@ -643,62 +670,55 @@ public static class BSParam
643 (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), 670 (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ),
644 671
645 new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy", 672 new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy",
646 7, 673 7 ),
647 (s) => { return CSHullMaxDepthSplit; },
648 (s,v) => { CSHullMaxDepthSplit = v; } ),
649 new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes", 674 new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes",
650 2, 675 2 ),
651 (s) => { return CSHullMaxDepthSplitForSimpleShapes; },
652 (s,v) => { CSHullMaxDepthSplitForSimpleShapes = v; } ),
653 new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)", 676 new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)",
654 5f, 677 5f ),
655 (s) => { return CSHullConcavityThresholdPercent; },
656 (s,v) => { CSHullConcavityThresholdPercent = v; } ),
657 new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)", 678 new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)",
658 5f, 679 5f ),
659 (s) => { return CSHullVolumeConservationThresholdPercent; },
660 (s,v) => { CSHullVolumeConservationThresholdPercent = v; } ),
661 new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.", 680 new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.",
662 32, 681 32 ),
663 (s) => { return CSHullMaxVertices; },
664 (s,v) => { CSHullMaxVertices = v; } ),
665 new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.", 682 new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.",
666 0, 683 0f ),
667 (s) => { return CSHullMaxSkinWidth; }, 684
668 (s,v) => { CSHullMaxSkinWidth = v; } ), 685 new ParameterDefn<float>("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull",
686 100f ),
687 new ParameterDefn<float>("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh",
688 2f ),
689 new ParameterDefn<float>("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls",
690 0.1f ),
691 new ParameterDefn<float>("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull",
692 0f ),
693 new ParameterDefn<float>("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be",
694 100f ),
695 new ParameterDefn<bool>("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors",
696 false ),
697 new ParameterDefn<bool>("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls",
698 false ),
699 new ParameterDefn<bool>("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces",
700 false ),
701 new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin",
702 false ),
669 703
670 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 704 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
671 (float)BSLinkset.LinksetImplementation.Compound, 705 (float)BSLinkset.LinksetImplementation.Compound ),
672 (s) => { return LinksetImplementation; }, 706 new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same",
673 (s,v) => { LinksetImplementation = v; } ), 707 true ),
674 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", 708 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
675 false, 709 false ),
676 (s) => { return LinkConstraintUseFrameOffset; },
677 (s,v) => { LinkConstraintUseFrameOffset = v; } ),
678 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", 710 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
679 true, 711 true ),
680 (s) => { return LinkConstraintEnableTransMotor; },
681 (s,v) => { LinkConstraintEnableTransMotor = v; } ),
682 new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", 712 new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
683 5.0f, 713 5.0f ),
684 (s) => { return LinkConstraintTransMotorMaxVel; },
685 (s,v) => { LinkConstraintTransMotorMaxVel = v; } ),
686 new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", 714 new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
687 0.1f, 715 0.1f ),
688 (s) => { return LinkConstraintTransMotorMaxForce; },
689 (s,v) => { LinkConstraintTransMotorMaxForce = v; } ),
690 new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", 716 new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1",
691 0.1f, 717 0.1f ),
692 (s) => { return LinkConstraintCFM; },
693 (s,v) => { LinkConstraintCFM = v; } ),
694 new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", 718 new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2",
695 0.1f, 719 0.1f ),
696 (s) => { return LinkConstraintERP; },
697 (s,v) => { LinkConstraintERP = v; } ),
698 new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", 720 new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)",
699 40, 721 40 ),
700 (s) => { return LinkConstraintSolverIterations; },
701 (s,v) => { LinkConstraintSolverIterations = v; } ),
702 722
703 new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", 723 new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
704 0, 724 0,
@@ -707,7 +727,7 @@ public static class BSParam
707 new ParameterDefn<float>("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", 727 new ParameterDefn<float>("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool",
708 0f, 728 0f,
709 (s) => { return 0f; }, 729 (s) => { return 0f; },
710 (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), 730 (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v, false /* inTaintTime */); } ),
711 new ParameterDefn<float>("ResetConstraintSolver", "Setting this is any value resets the constraint solver", 731 new ParameterDefn<float>("ResetConstraintSolver", "Setting this is any value resets the constraint solver",
712 0f, 732 0f,
713 (s) => { return 0f; }, 733 (s) => { return 0f; },
@@ -793,10 +813,10 @@ public static class BSParam
793 // ===================================================================== 813 // =====================================================================
794 // There are parameters that, when set, cause things to happen in the physics engine. 814 // There are parameters that, when set, cause things to happen in the physics engine.
795 // This causes the broadphase collision cache to be cleared. 815 // This causes the broadphase collision cache to be cleared.
796 private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) 816 private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v, bool inTaintTime)
797 { 817 {
798 BSScene physScene = pPhysScene; 818 BSScene physScene = pPhysScene;
799 physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() 819 physScene.TaintedObject(inTaintTime, "BSParam.ResetBroadphasePoolTainted", delegate()
800 { 820 {
801 physScene.PE.ResetBroadphasePool(physScene.World); 821 physScene.PE.ResetBroadphasePool(physScene.World);
802 }); 822 });