aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2013-02-16 22:14:38 -0800
committerRobert Adams2013-02-17 20:13:48 -0800
commit885b45b112607e3edf12838cf01cfefa6da884ae (patch)
treebd328e463e7d7da8bc1430f1d21e77b928868d4f /OpenSim
parent* Fix walking to <NaN, NaN, NaN> via autopilot. (diff)
downloadopensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.zip
opensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.tar.gz
opensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.tar.bz2
opensim-SC_OLD-885b45b112607e3edf12838cf01cfefa6da884ae.tar.xz
BulletSim: rework parameter setting for different types of values
(like vectors or quaternions).
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs4
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs674
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs54
5 files changed, 348 insertions, 394 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
index 39e62dd..15fa52b 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs
@@ -1133,8 +1133,8 @@ private sealed class BulletConstraintXNA : BulletConstraint
1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations; 1133 p.numberOfSolverIterations = o[0].numberOfSolverIterations;
1134 1134
1135 p.linksetImplementation = BSParam.LinksetImplementation; 1135 p.linksetImplementation = BSParam.LinksetImplementation;
1136 p.linkConstraintUseFrameOffset = BSParam.LinkConstraintUseFrameOffset; 1136 p.linkConstraintUseFrameOffset = BSParam.NumericBool(BSParam.LinkConstraintUseFrameOffset);
1137 p.linkConstraintEnableTransMotor = BSParam.LinkConstraintEnableTransMotor; 1137 p.linkConstraintEnableTransMotor = BSParam.NumericBool(BSParam.LinkConstraintEnableTransMotor);
1138 p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel; 1138 p.linkConstraintTransMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
1139 p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce; 1139 p.linkConstraintTransMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
1140 p.linkConstraintERP = BSParam.LinkConstraintERP; 1140 p.linkConstraintERP = BSParam.LinkConstraintERP;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 41d353a..e6933f9 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
144 enableAngularVerticalAttraction = true; 144 enableAngularVerticalAttraction = true;
145 enableAngularDeflection = false; 145 enableAngularDeflection = false;
146 enableAngularBanking = false; 146 enableAngularBanking = false;
147 if (BSParam.VehicleDebuggingEnabled != ConfigurationParameters.numericFalse) 147 if (BSParam.VehicleDebuggingEnabled)
148 { 148 {
149 enableAngularVerticalAttraction = true; 149 enableAngularVerticalAttraction = true;
150 enableAngularDeflection = false; 150 enableAngularDeflection = false;
@@ -607,8 +607,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
607 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 607 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
608 // Maybe compute linear and angular factor and damping from params. 608 // Maybe compute linear and angular factor and damping from params.
609 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, BSParam.VehicleAngularDamping); 609 PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, BSParam.VehicleAngularDamping);
610 PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactorV); 610 PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactor);
611 PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactorV); 611 PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactor);
612 612
613 // Vehicles report collision events so we know when it's on the ground 613 // Vehicles report collision events so we know when it's on the ground
614 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 614 PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index cc814d1..6d252ca 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -223,8 +223,8 @@ public sealed class BSLinksetConstraints : BSLinkset
223 constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero); 223 constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
224 224
225 // tweek the constraint to increase stability 225 // tweek the constraint to increase stability
226 constrain.UseFrameOffset(BSParam.BoolNumeric(BSParam.LinkConstraintUseFrameOffset)); 226 constrain.UseFrameOffset(BSParam.LinkConstraintUseFrameOffset);
227 constrain.TranslationalLimitMotor(BSParam.BoolNumeric(BSParam.LinkConstraintEnableTransMotor), 227 constrain.TranslationalLimitMotor(BSParam.LinkConstraintEnableTransMotor,
228 BSParam.LinkConstraintTransMotorMaxVel, 228 BSParam.LinkConstraintTransMotorMaxVel,
229 BSParam.LinkConstraintTransMotorMaxForce); 229 BSParam.LinkConstraintTransMotorMaxForce);
230 constrain.SetCFMAndERP(BSParam.LinkConstraintCFM, BSParam.LinkConstraintERP); 230 constrain.SetCFMAndERP(BSParam.LinkConstraintCFM, BSParam.LinkConstraintERP);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 329169f..c2a9671 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
37{ 37{
38public static class BSParam 38public static class BSParam
39{ 39{
40 private static string LogHeader = "[BULLETSIM PARAMETERS]";
41
40 // Level of Detail values kept as float because that's what the Meshmerizer wants 42 // Level of Detail values kept as float because that's what the Meshmerizer wants
41 public static float MeshLOD { get; private set; } 43 public static float MeshLOD { get; private set; }
42 public static float MeshCircularLOD { get; private set; } 44 public static float MeshCircularLOD { get; private set; }
@@ -80,14 +82,13 @@ public static class BSParam
80 // Physics Engine operation 82 // Physics Engine operation
81 public static float MaxPersistantManifoldPoolSize; 83 public static float MaxPersistantManifoldPoolSize;
82 public static float MaxCollisionAlgorithmPoolSize; 84 public static float MaxCollisionAlgorithmPoolSize;
83 public static float ShouldDisableContactPoolDynamicAllocation; 85 public static bool ShouldDisableContactPoolDynamicAllocation;
84 public static float ShouldForceUpdateAllAabbs; 86 public static bool ShouldForceUpdateAllAabbs;
85 public static float ShouldRandomizeSolverOrder; 87 public static bool ShouldRandomizeSolverOrder;
86 public static float ShouldSplitSimulationIslands; 88 public static bool ShouldSplitSimulationIslands;
87 public static float ShouldEnableFrictionCaching; 89 public static bool ShouldEnableFrictionCaching;
88 public static float NumberOfSolverIterations; 90 public static float NumberOfSolverIterations;
89 public static bool UseSingleSidedMeshes { get { return UseSingleSidedMeshesF != ConfigurationParameters.numericFalse; } } 91 public static bool UseSingleSidedMeshes;
90 public static float UseSingleSidedMeshesF;
91 public static float GlobalContactBreakingThreshold; 92 public static float GlobalContactBreakingThreshold;
92 93
93 // Avatar parameters 94 // Avatar parameters
@@ -112,16 +113,14 @@ public static class BSParam
112 public static float VehicleAngularDamping { get; private set; } 113 public static float VehicleAngularDamping { get; private set; }
113 public static float VehicleFriction { get; private set; } 114 public static float VehicleFriction { get; private set; }
114 public static float VehicleRestitution { get; private set; } 115 public static float VehicleRestitution { get; private set; }
115 public static float VehicleLinearFactor { get; private set; } 116 public static Vector3 VehicleLinearFactor { get; private set; }
116 public static Vector3 VehicleLinearFactorV { get; private set; } 117 public static Vector3 VehicleAngularFactor { get; private set; }
117 public static float VehicleAngularFactor { get; private set; }
118 public static Vector3 VehicleAngularFactorV { get; private set; }
119 public static float VehicleGroundGravityFudge { get; private set; } 118 public static float VehicleGroundGravityFudge { get; private set; }
120 public static float VehicleDebuggingEnabled { get; private set; } 119 public static bool VehicleDebuggingEnabled { get; private set; }
121 120
122 public static float LinksetImplementation { get; private set; } 121 public static float LinksetImplementation { get; private set; }
123 public static float LinkConstraintUseFrameOffset { get; private set; } 122 public static bool LinkConstraintUseFrameOffset { get; private set; }
124 public static float LinkConstraintEnableTransMotor { get; private set; } 123 public static bool LinkConstraintEnableTransMotor { get; private set; }
125 public static float LinkConstraintTransMotorMaxVel { get; private set; } 124 public static float LinkConstraintTransMotorMaxVel { get; private set; }
126 public static float LinkConstraintTransMotorMaxForce { get; private set; } 125 public static float LinkConstraintTransMotorMaxForce { get; private set; }
127 public static float LinkConstraintERP { get; private set; } 126 public static float LinkConstraintERP { get; private set; }
@@ -141,40 +140,106 @@ public static class BSParam
141 public const float MinRestitution = 0f; 140 public const float MinRestitution = 0f;
142 public const float MaxRestitution = 1f; 141 public const float MaxRestitution = 1f;
143 142
144 // =========================================================================== 143 // =====================================================================================
145 public delegate void ParamUser(BSScene scene, IConfig conf, string paramName, float val); 144 // =====================================================================================
146 public delegate float ParamGet(BSScene scene);
147 public delegate void ParamSet(BSScene scene, string paramName, uint localID, float val);
148 public delegate void SetOnObject(BSScene scene, BSPhysObject obj, float val);
149 145
150 public struct ParameterDefn 146 // Base parameter definition that gets and sets parameter values via a string
147 public abstract class ParameterDefnBase
151 { 148 {
152 public string name; // string name of the parameter 149 public string name; // string name of the parameter
153 public string desc; // a short description of what the parameter means 150 public string desc; // a short description of what the parameter means
154 public float defaultValue; // default value if not specified anywhere else 151 public ParameterDefnBase(string pName, string pDesc)
155 public ParamUser userParam; // get the value from the configuration file 152 {
156 public ParamGet getter; // return the current value stored for this parameter 153 name = pName;
157 public ParamSet setter; // set the current value for this parameter 154 desc = pDesc;
158 public SetOnObject onObject; // set the value on an object in the physical domain 155 }
159 public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s) 156 // Set the parameter value to the default
157 public abstract void AssignDefault(BSScene s);
158 // Get the value as a string
159 public abstract string GetValue(BSScene s);
160 // Set the value to this string value
161 public abstract void SetValue(BSScene s, string valAsString);
162 // set the value on a particular object (usually sets in physics engine)
163 public abstract void SetOnObject(BSScene s, BSPhysObject obj);
164 public abstract bool HasSetOnObject { get; }
165 }
166
167 // Specific parameter definition for a parameter of a specific type.
168 public delegate T PGetValue<T>(BSScene s);
169 public delegate void PSetValue<T>(BSScene s, T val);
170 public delegate void PSetOnObject<T>(BSScene scene, BSPhysObject obj);
171 public sealed class ParameterDefn<T> : ParameterDefnBase
172 {
173 T defaultValue;
174 PSetValue<T> setter;
175 PGetValue<T> getter;
176 PSetOnObject<T> objectSet;
177 public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter)
178 : base(pName, pDesc)
179 {
180 defaultValue = pDefault;
181 setter = pSetter;
182 getter = pGetter;
183 objectSet = null;
184 }
185 public ParameterDefn(string pName, string pDesc, T pDefault, PGetValue<T> pGetter, PSetValue<T> pSetter, PSetOnObject<T> pObjSetter)
186 : base(pName, pDesc)
187 {
188 defaultValue = pDefault;
189 setter = pSetter;
190 getter = pGetter;
191 objectSet = pObjSetter;
192 }
193 public override void AssignDefault(BSScene s)
194 {
195 setter(s, defaultValue);
196 }
197 public override string GetValue(BSScene s)
198 {
199 return String.Format("{0}", getter(s));
200 }
201 public override void SetValue(BSScene s, string valAsString)
160 { 202 {
161 name = n; 203 // Get the generic type of the setter
162 desc = d; 204 Type genericType = setter.GetType().GetGenericArguments()[0];
163 defaultValue = v; 205 // Find the 'Parse' method on that type
164 userParam = u; 206 System.Reflection.MethodInfo parser = null;
165 getter = g; 207 try
166 setter = s; 208 {
167 onObject = null; 209 parser = genericType.GetMethod("Parse", new Type[] { typeof(String) } );
210 }
211 catch (Exception e)
212 {
213 s.Logger.ErrorFormat("{0} Exception getting parser for type '{1}': {2}", LogHeader, genericType, e);
214 parser = null;
215 }
216 if (parser != null)
217 {
218 // Parse the input string
219 try
220 {
221 T setValue = (T)parser.Invoke(genericType, new Object[] { valAsString });
222 setter(s, setValue);
223 // s.Logger.DebugFormat("{0} Parameter {1} = {2}", LogHeader, name, setValue);
224 }
225 catch
226 {
227 s.Logger.ErrorFormat("{0} Failed parsing parameter value '{1}' as type '{2}'", LogHeader, valAsString, genericType);
228 }
229 }
230 else
231 {
232 s.Logger.ErrorFormat("{0} Could not find parameter parser for type '{1}'", LogHeader, genericType);
233 }
234 }
235 public override bool HasSetOnObject
236 {
237 get { return objectSet != null; }
168 } 238 }
169 public ParameterDefn(string n, string d, float v, ParamUser u, ParamGet g, ParamSet s, SetOnObject o) 239 public override void SetOnObject(BSScene s, BSPhysObject obj)
170 { 240 {
171 name = n; 241 if (objectSet != null)
172 desc = d; 242 objectSet(s, obj);
173 defaultValue = v;
174 userParam = u;
175 getter = g;
176 setter = s;
177 onObject = o;
178 } 243 }
179 } 244 }
180 245
@@ -184,462 +249,375 @@ public static class BSParam
184 // location somewhere in the program and make an entry in this table with the 249 // location somewhere in the program and make an entry in this table with the
185 // getters and setters. 250 // getters and setters.
186 // It is easiest to find an existing definition and copy it. 251 // It is easiest to find an existing definition and copy it.
187 // Parameter values are floats. Booleans are converted to a floating value.
188 // 252 //
189 // A ParameterDefn() takes the following parameters: 253 // A ParameterDefn<T>() takes the following parameters:
190 // -- the text name of the parameter. This is used for console input and ini file. 254 // -- the text name of the parameter. This is used for console input and ini file.
191 // -- a short text description of the parameter. This shows up in the console listing. 255 // -- a short text description of the parameter. This shows up in the console listing.
192 // -- a default value (float) 256 // -- a default value
193 // -- a delegate for fetching the parameter from the ini file. 257 // -- a delegate for getting the value
194 // Should handle fetching the right type from the ini file and converting it. 258 // -- a delegate for setting the value
195 // -- a delegate for getting the value as a float
196 // -- a delegate for setting the value from a float
197 // -- an optional delegate to update the value in the world. Most often used to 259 // -- an optional delegate to update the value in the world. Most often used to
198 // push the new value to an in-world object. 260 // push the new value to an in-world object.
199 // 261 //
200 // The single letter parameters for the delegates are: 262 // The single letter parameters for the delegates are:
201 // s = BSScene 263 // s = BSScene
202 // o = BSPhysObject 264 // o = BSPhysObject
203 // p = string parameter name
204 // l = localID of referenced object
205 // v = value (float) 265 // v = value (float)
206 // cf = parameter configuration class (for fetching values from ini file) 266 private static ParameterDefnBase[] ParameterDefinitions =
207 private static ParameterDefn[] ParameterDefinitions =
208 { 267 {
209 new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", 268 new ParameterDefn<bool>("MeshSculptedPrim", "Whether to create meshes for sculpties",
210 ConfigurationParameters.numericTrue, 269 true,
211 (s,cf,p,v) => { ShouldMeshSculptedPrim = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 270 (s) => { return ShouldMeshSculptedPrim; },
212 (s) => { return BSParam.NumericBool(ShouldMeshSculptedPrim); }, 271 (s,v) => { ShouldMeshSculptedPrim = v; } ),
213 (s,p,l,v) => { ShouldMeshSculptedPrim = BSParam.BoolNumeric(v); } ), 272 new ParameterDefn<bool>("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects",
214 new ParameterDefn("ForceSimplePrimMeshing", "If true, only use primitive meshes for objects", 273 false,
215 ConfigurationParameters.numericFalse, 274 (s) => { return ShouldForceSimplePrimMeshing; },
216 (s,cf,p,v) => { ShouldForceSimplePrimMeshing = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 275 (s,v) => { ShouldForceSimplePrimMeshing = v; } ),
217 (s) => { return BSParam.NumericBool(ShouldForceSimplePrimMeshing); }, 276 new ParameterDefn<bool>("UseHullsForPhysicalObjects", "If true, create hulls for physical objects",
218 (s,p,l,v) => { ShouldForceSimplePrimMeshing = BSParam.BoolNumeric(v); } ), 277 true,
219 new ParameterDefn("UseHullsForPhysicalObjects", "If true, create hulls for physical objects", 278 (s) => { return ShouldUseHullsForPhysicalObjects; },
220 ConfigurationParameters.numericTrue, 279 (s,v) => { ShouldUseHullsForPhysicalObjects = v; } ),
221 (s,cf,p,v) => { ShouldUseHullsForPhysicalObjects = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 280 new ParameterDefn<bool>("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
222 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, 281 true,
223 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), 282 (s) => { return ShouldRemoveZeroWidthTriangles; },
224 new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", 283 (s,v) => { ShouldRemoveZeroWidthTriangles = v; } ),
225 ConfigurationParameters.numericTrue, 284
226 (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 285 new ParameterDefn<float>("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
227 (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); },
228 (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ),
229
230 new ParameterDefn("MeshLevelOfDetail", "Level of detail to render meshes (32, 16, 8 or 4. 32=most detailed)",
231 32f, 286 32f,
232 (s,cf,p,v) => { MeshLOD = (float)cf.GetInt(p, (int)v); },
233 (s) => { return MeshLOD; }, 287 (s) => { return MeshLOD; },
234 (s,p,l,v) => { MeshLOD = v; } ), 288 (s,v) => { MeshLOD = v; } ),
235 new ParameterDefn("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes", 289 new ParameterDefn<float>("MeshLevelOfDetailCircular", "Level of detail for prims with circular cuts or shapes",
236 32f, 290 32f,
237 (s,cf,p,v) => { MeshCircularLOD = (float)cf.GetInt(p, (int)v); },
238 (s) => { return MeshCircularLOD; }, 291 (s) => { return MeshCircularLOD; },
239 (s,p,l,v) => { MeshCircularLOD = v; } ), 292 (s,v) => { MeshCircularLOD = v; } ),
240 new ParameterDefn("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD", 293 new ParameterDefn<float>("MeshLevelOfDetailMegaPrimThreshold", "Size (in meters) of a mesh before using MeshMegaPrimLOD",
241 10f, 294 10f,
242 (s,cf,p,v) => { MeshMegaPrimThreshold = (float)cf.GetInt(p, (int)v); },
243 (s) => { return MeshMegaPrimThreshold; }, 295 (s) => { return MeshMegaPrimThreshold; },
244 (s,p,l,v) => { MeshMegaPrimThreshold = v; } ), 296 (s,v) => { MeshMegaPrimThreshold = v; } ),
245 new ParameterDefn("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters", 297 new ParameterDefn<float>("MeshLevelOfDetailMegaPrim", "Level of detail to render meshes larger than threshold meters",
246 32f, 298 32f,
247 (s,cf,p,v) => { MeshMegaPrimLOD = (float)cf.GetInt(p, (int)v); },
248 (s) => { return MeshMegaPrimLOD; }, 299 (s) => { return MeshMegaPrimLOD; },
249 (s,p,l,v) => { MeshMegaPrimLOD = v; } ), 300 (s,v) => { MeshMegaPrimLOD = v; } ),
250 new ParameterDefn("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)", 301 new ParameterDefn<float>("SculptLevelOfDetail", "Level of detail to render sculpties (32, 16, 8 or 4. 32=most detailed)",
251 32f, 302 32f,
252 (s,cf,p,v) => { SculptLOD = (float)cf.GetInt(p, (int)v); },
253 (s) => { return SculptLOD; }, 303 (s) => { return SculptLOD; },
254 (s,p,l,v) => { SculptLOD = v; } ), 304 (s,v) => { SculptLOD = v; } ),
255 305
256 new ParameterDefn("MaxSubStep", "In simulation step, maximum number of substeps", 306 new ParameterDefn<int>("MaxSubStep", "In simulation step, maximum number of substeps",
257 10f, 307 10,
258 (s,cf,p,v) => { s.m_maxSubSteps = cf.GetInt(p, (int)v); }, 308 (s) => { return s.m_maxSubSteps; },
259 (s) => { return (float)s.m_maxSubSteps; }, 309 (s,v) => { s.m_maxSubSteps = (int)v; } ),
260 (s,p,l,v) => { s.m_maxSubSteps = (int)v; } ), 310 new ParameterDefn<float>("FixedTimeStep", "In simulation step, seconds of one substep (1/60)",
261 new ParameterDefn("FixedTimeStep", "In simulation step, seconds of one substep (1/60)",
262 1f / 60f, 311 1f / 60f,
263 (s,cf,p,v) => { s.m_fixedTimeStep = cf.GetFloat(p, v); }, 312 (s) => { return s.m_fixedTimeStep; },
264 (s) => { return (float)s.m_fixedTimeStep; }, 313 (s,v) => { s.m_fixedTimeStep = v; } ),
265 (s,p,l,v) => { s.m_fixedTimeStep = v; } ), 314 new ParameterDefn<float>("NominalFrameRate", "The base frame rate we claim",
266 new ParameterDefn("NominalFrameRate", "The base frame rate we claim",
267 55f, 315 55f,
268 (s,cf,p,v) => { s.NominalFrameRate = cf.GetInt(p, (int)v); }, 316 (s) => { return s.NominalFrameRate; },
269 (s) => { return (float)s.NominalFrameRate; }, 317 (s,v) => { s.NominalFrameRate = (int)v; } ),
270 (s,p,l,v) => { s.NominalFrameRate = (int)v; } ), 318 new ParameterDefn<int>("MaxCollisionsPerFrame", "Max collisions returned at end of each frame",
271 new ParameterDefn("MaxCollisionsPerFrame", "Max collisions returned at end of each frame", 319 2048,
272 2048f, 320 (s) => { return s.m_maxCollisionsPerFrame; },
273 (s,cf,p,v) => { s.m_maxCollisionsPerFrame = cf.GetInt(p, (int)v); }, 321 (s,v) => { s.m_maxCollisionsPerFrame = (int)v; } ),
274 (s) => { return (float)s.m_maxCollisionsPerFrame; }, 322 new ParameterDefn<int>("MaxUpdatesPerFrame", "Max updates returned at end of each frame",
275 (s,p,l,v) => { s.m_maxCollisionsPerFrame = (int)v; } ), 323 8000,
276 new ParameterDefn("MaxUpdatesPerFrame", "Max updates returned at end of each frame", 324 (s) => { return s.m_maxUpdatesPerFrame; },
277 8000f, 325 (s,v) => { s.m_maxUpdatesPerFrame = (int)v; } ),
278 (s,cf,p,v) => { s.m_maxUpdatesPerFrame = cf.GetInt(p, (int)v); }, 326
279 (s) => { return (float)s.m_maxUpdatesPerFrame; }, 327 new ParameterDefn<float>("MinObjectMass", "Minimum object mass (0.0001)",
280 (s,p,l,v) => { s.m_maxUpdatesPerFrame = (int)v; } ),
281
282 new ParameterDefn("MinObjectMass", "Minimum object mass (0.0001)",
283 0.0001f, 328 0.0001f,
284 (s,cf,p,v) => { MinimumObjectMass = cf.GetFloat(p, v); },
285 (s) => { return MinimumObjectMass; }, 329 (s) => { return MinimumObjectMass; },
286 (s,p,l,v) => { MinimumObjectMass = v; } ), 330 (s,v) => { MinimumObjectMass = v; } ),
287 new ParameterDefn("MaxObjectMass", "Maximum object mass (10000.01)", 331 new ParameterDefn<float>("MaxObjectMass", "Maximum object mass (10000.01)",
288 10000.01f, 332 10000.01f,
289 (s,cf,p,v) => { MaximumObjectMass = cf.GetFloat(p, v); },
290 (s) => { return MaximumObjectMass; }, 333 (s) => { return MaximumObjectMass; },
291 (s,p,l,v) => { MaximumObjectMass = v; } ), 334 (s,v) => { MaximumObjectMass = v; } ),
292 new ParameterDefn("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object", 335 new ParameterDefn<float>("MaxLinearVelocity", "Maximum velocity magnitude that can be assigned to an object",
293 1000.0f, 336 1000.0f,
294 (s,cf,p,v) => { MaxLinearVelocity = cf.GetFloat(p, v); },
295 (s) => { return MaxLinearVelocity; }, 337 (s) => { return MaxLinearVelocity; },
296 (s,p,l,v) => { MaxLinearVelocity = v; } ), 338 (s,v) => { MaxLinearVelocity = v; } ),
297 new ParameterDefn("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object", 339 new ParameterDefn<float>("MaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to an object",
298 1000.0f, 340 1000.0f,
299 (s,cf,p,v) => { MaxAngularVelocity = cf.GetFloat(p, v); },
300 (s) => { return MaxAngularVelocity; }, 341 (s) => { return MaxAngularVelocity; },
301 (s,p,l,v) => { MaxAngularVelocity = v; } ), 342 (s,v) => { MaxAngularVelocity = v; } ),
302 // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject 343 // LL documentation says thie number should be 20f for llApplyImpulse and 200f for llRezObject
303 new ParameterDefn("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)", 344 new ParameterDefn<float>("MaxAddForceMagnitude", "Maximum force that can be applied by llApplyImpulse (SL says 20f)",
304 20000.0f, 345 20000.0f,
305 (s,cf,p,v) => { MaxAddForceMagnitude = cf.GetFloat(p, v); },
306 (s) => { return MaxAddForceMagnitude; }, 346 (s) => { return MaxAddForceMagnitude; },
307 (s,p,l,v) => { MaxAddForceMagnitude = v; } ), 347 (s,v) => { MaxAddForceMagnitude = v; } ),
308 // Density is passed around as 100kg/m3. This scales that to 1kg/m3. 348 // Density is passed around as 100kg/m3. This scales that to 1kg/m3.
309 new ParameterDefn("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)", 349 new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
310 0.01f, 350 0.01f,
311 (s,cf,p,v) => { DensityScaleFactor = cf.GetFloat(p, v); },
312 (s) => { return DensityScaleFactor; }, 351 (s) => { return DensityScaleFactor; },
313 (s,p,l,v) => { DensityScaleFactor = v; } ), 352 (s,v) => { DensityScaleFactor = v; } ),
314 353
315 new ParameterDefn("PID_D", "Derivitive factor for motion smoothing", 354 new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing",
316 2200f, 355 2200f,
317 (s,cf,p,v) => { PID_D = cf.GetFloat(p, v); },
318 (s) => { return (float)PID_D; }, 356 (s) => { return (float)PID_D; },
319 (s,p,l,v) => { PID_D = v; } ), 357 (s,v) => { PID_D = v; } ),
320 new ParameterDefn("PID_P", "Parameteric factor for motion smoothing", 358 new ParameterDefn<float>("PID_P", "Parameteric factor for motion smoothing",
321 900f, 359 900f,
322 (s,cf,p,v) => { PID_P = cf.GetFloat(p, v); },
323 (s) => { return (float)PID_P; }, 360 (s) => { return (float)PID_P; },
324 (s,p,l,v) => { PID_P = v; } ), 361 (s,v) => { PID_P = v; } ),
325 362
326 new ParameterDefn("DefaultFriction", "Friction factor used on new objects", 363 new ParameterDefn<float>("DefaultFriction", "Friction factor used on new objects",
327 0.2f, 364 0.2f,
328 (s,cf,p,v) => { DefaultFriction = cf.GetFloat(p, v); },
329 (s) => { return DefaultFriction; }, 365 (s) => { return DefaultFriction; },
330 (s,p,l,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ), 366 (s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
331 new ParameterDefn("DefaultDensity", "Density for new objects" , 367 new ParameterDefn<float>("DefaultDensity", "Density for new objects" ,
332 10.000006836f, // Aluminum g/cm3 368 10.000006836f, // Aluminum g/cm3
333 (s,cf,p,v) => { DefaultDensity = cf.GetFloat(p, v); },
334 (s) => { return DefaultDensity; }, 369 (s) => { return DefaultDensity; },
335 (s,p,l,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ), 370 (s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
336 new ParameterDefn("DefaultRestitution", "Bouncyness of an object" , 371 new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" ,
337 0f, 372 0f,
338 (s,cf,p,v) => { DefaultRestitution = cf.GetFloat(p, v); },
339 (s) => { return DefaultRestitution; }, 373 (s) => { return DefaultRestitution; },
340 (s,p,l,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ), 374 (s,v) => { DefaultRestitution = v; s.UnmanagedParams[0].defaultRestitution = v; } ),
341 new ParameterDefn("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)", 375 new ParameterDefn<float>("CollisionMargin", "Margin around objects before collisions are calculated (must be zero!)",
342 0.04f, 376 0.04f,
343 (s,cf,p,v) => { CollisionMargin = cf.GetFloat(p, v); },
344 (s) => { return CollisionMargin; }, 377 (s) => { return CollisionMargin; },
345 (s,p,l,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ), 378 (s,v) => { CollisionMargin = v; s.UnmanagedParams[0].collisionMargin = v; } ),
346 new ParameterDefn("Gravity", "Vertical force of gravity (negative means down)", 379 new ParameterDefn<float>("Gravity", "Vertical force of gravity (negative means down)",
347 -9.80665f, 380 -9.80665f,
348 (s,cf,p,v) => { Gravity = cf.GetFloat(p, v); },
349 (s) => { return Gravity; }, 381 (s) => { return Gravity; },
350 (s,p,l,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; }, 382 (s,v) => { Gravity = v; s.UnmanagedParams[0].gravity = v; },
351 (s,o,v) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,v)); } ), 383 (s,o) => { s.PE.SetGravity(o.PhysBody, new Vector3(0f,0f,Gravity)); } ),
352 384
353 385
354 new ParameterDefn("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)", 386 new ParameterDefn<float>("LinearDamping", "Factor to damp linear movement per second (0.0 - 1.0)",
355 0f, 387 0f,
356 (s,cf,p,v) => { LinearDamping = cf.GetFloat(p, v); },
357 (s) => { return LinearDamping; }, 388 (s) => { return LinearDamping; },
358 (s,p,l,v) => { LinearDamping = v; }, 389 (s,v) => { LinearDamping = v; },
359 (s,o,v) => { s.PE.SetDamping(o.PhysBody, v, AngularDamping); } ), 390 (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ),
360 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 391 new ParameterDefn<float>("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)",
361 0f, 392 0f,
362 (s,cf,p,v) => { AngularDamping = cf.GetFloat(p, v); },
363 (s) => { return AngularDamping; }, 393 (s) => { return AngularDamping; },
364 (s,p,l,v) => { AngularDamping = v; }, 394 (s,v) => { AngularDamping = v; },
365 (s,o,v) => { s.PE.SetDamping(o.PhysBody, LinearDamping, v); } ), 395 (s,o) => { s.PE.SetDamping(o.PhysBody, LinearDamping, AngularDamping); } ),
366 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 396 new ParameterDefn<float>("DeactivationTime", "Seconds before considering an object potentially static",
367 0.2f, 397 0.2f,
368 (s,cf,p,v) => { DeactivationTime = cf.GetFloat(p, v); },
369 (s) => { return DeactivationTime; }, 398 (s) => { return DeactivationTime; },
370 (s,p,l,v) => { DeactivationTime = v; }, 399 (s,v) => { DeactivationTime = v; },
371 (s,o,v) => { s.PE.SetDeactivationTime(o.PhysBody, v); } ), 400 (s,o) => { s.PE.SetDeactivationTime(o.PhysBody, DeactivationTime); } ),
372 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 401 new ParameterDefn<float>("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
373 0.8f, 402 0.8f,
374 (s,cf,p,v) => { LinearSleepingThreshold = cf.GetFloat(p, v); },
375 (s) => { return LinearSleepingThreshold; }, 403 (s) => { return LinearSleepingThreshold; },
376 (s,p,l,v) => { LinearSleepingThreshold = v;}, 404 (s,v) => { LinearSleepingThreshold = v;},
377 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 405 (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ),
378 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 406 new ParameterDefn<float>("AngularSleepingThreshold", "Seconds to measure angular movement before considering static",
379 1.0f, 407 1.0f,
380 (s,cf,p,v) => { AngularSleepingThreshold = cf.GetFloat(p, v); },
381 (s) => { return AngularSleepingThreshold; }, 408 (s) => { return AngularSleepingThreshold; },
382 (s,p,l,v) => { AngularSleepingThreshold = v;}, 409 (s,v) => { AngularSleepingThreshold = v;},
383 (s,o,v) => { s.PE.SetSleepingThresholds(o.PhysBody, v, v); } ), 410 (s,o) => { s.PE.SetSleepingThresholds(o.PhysBody, LinearSleepingThreshold, AngularSleepingThreshold); } ),
384 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 411 new ParameterDefn<float>("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
385 0.0f, // set to zero to disable 412 0.0f, // set to zero to disable
386 (s,cf,p,v) => { CcdMotionThreshold = cf.GetFloat(p, v); },
387 (s) => { return CcdMotionThreshold; }, 413 (s) => { return CcdMotionThreshold; },
388 (s,p,l,v) => { CcdMotionThreshold = v;}, 414 (s,v) => { CcdMotionThreshold = v;},
389 (s,o,v) => { s.PE.SetCcdMotionThreshold(o.PhysBody, v); } ), 415 (s,o) => { s.PE.SetCcdMotionThreshold(o.PhysBody, CcdMotionThreshold); } ),
390 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 416 new ParameterDefn<float>("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
391 0.2f, 417 0.2f,
392 (s,cf,p,v) => { CcdSweptSphereRadius = cf.GetFloat(p, v); },
393 (s) => { return CcdSweptSphereRadius; }, 418 (s) => { return CcdSweptSphereRadius; },
394 (s,p,l,v) => { CcdSweptSphereRadius = v;}, 419 (s,v) => { CcdSweptSphereRadius = v;},
395 (s,o,v) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, v); } ), 420 (s,o) => { s.PE.SetCcdSweptSphereRadius(o.PhysBody, CcdSweptSphereRadius); } ),
396 new ParameterDefn("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" , 421 new ParameterDefn<float>("ContactProcessingThreshold", "Distance above which contacts can be discarded (0 means no discard)" ,
397 0.0f, 422 0.0f,
398 (s,cf,p,v) => { ContactProcessingThreshold = cf.GetFloat(p, v); },
399 (s) => { return ContactProcessingThreshold; }, 423 (s) => { return ContactProcessingThreshold; },
400 (s,p,l,v) => { ContactProcessingThreshold = v;}, 424 (s,v) => { ContactProcessingThreshold = v;},
401 (s,o,v) => { s.PE.SetContactProcessingThreshold(o.PhysBody, v); } ), 425 (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
402 426
403 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", 427 new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
404 (float)BSTerrainPhys.TerrainImplementation.Mesh, 428 (float)BSTerrainPhys.TerrainImplementation.Mesh,
405 (s,cf,p,v) => { TerrainImplementation = cf.GetFloat(p,v); },
406 (s) => { return TerrainImplementation; }, 429 (s) => { return TerrainImplementation; },
407 (s,p,l,v) => { TerrainImplementation = v; } ), 430 (s,v) => { TerrainImplementation = v; } ),
408 new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 431 new ParameterDefn<float>("TerrainFriction", "Factor to reduce movement against terrain surface" ,
409 0.3f, 432 0.3f,
410 (s,cf,p,v) => { TerrainFriction = cf.GetFloat(p, v); },
411 (s) => { return TerrainFriction; }, 433 (s) => { return TerrainFriction; },
412 (s,p,l,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ), 434 (s,v) => { TerrainFriction = v; /* TODO: set on real terrain */} ),
413 new ParameterDefn("TerrainHitFraction", "Distance to measure hit collisions" , 435 new ParameterDefn<float>("TerrainHitFraction", "Distance to measure hit collisions" ,
414 0.8f, 436 0.8f,
415 (s,cf,p,v) => { TerrainHitFraction = cf.GetFloat(p, v); },
416 (s) => { return TerrainHitFraction; }, 437 (s) => { return TerrainHitFraction; },
417 (s,p,l,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ), 438 (s,v) => { TerrainHitFraction = v; /* TODO: set on real terrain */ } ),
418 new ParameterDefn("TerrainRestitution", "Bouncyness" , 439 new ParameterDefn<float>("TerrainRestitution", "Bouncyness" ,
419 0f, 440 0f,
420 (s,cf,p,v) => { TerrainRestitution = cf.GetFloat(p, v); },
421 (s) => { return TerrainRestitution; }, 441 (s) => { return TerrainRestitution; },
422 (s,p,l,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ), 442 (s,v) => { TerrainRestitution = v; /* TODO: set on real terrain */ } ),
423 new ParameterDefn("TerrainCollisionMargin", "Margin where collision checking starts" , 443 new ParameterDefn<float>("TerrainCollisionMargin", "Margin where collision checking starts" ,
424 0.08f, 444 0.08f,
425 (s,cf,p,v) => { TerrainCollisionMargin = cf.GetFloat(p, v); },
426 (s) => { return TerrainCollisionMargin; }, 445 (s) => { return TerrainCollisionMargin; },
427 (s,p,l,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ), 446 (s,v) => { TerrainCollisionMargin = v; /* TODO: set on real terrain */ } ),
428 447
429 new ParameterDefn("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.", 448 new ParameterDefn<float>("AvatarFriction", "Factor to reduce movement against an avatar. Changed on avatar recreation.",
430 0.2f, 449 0.2f,
431 (s,cf,p,v) => { AvatarFriction = cf.GetFloat(p, v); },
432 (s) => { return AvatarFriction; }, 450 (s) => { return AvatarFriction; },
433 (s,p,l,v) => { AvatarFriction = v; } ), 451 (s,v) => { AvatarFriction = v; } ),
434 new ParameterDefn("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 452 new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
435 0.95f, 453 0.95f,
436 (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); },
437 (s) => { return AvatarStandingFriction; }, 454 (s) => { return AvatarStandingFriction; },
438 (s,p,l,v) => { AvatarStandingFriction = v; } ), 455 (s,v) => { AvatarStandingFriction = v; } ),
439 new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 456 new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
440 1.3f, 457 1.3f,
441 (s,cf,p,v) => { AvatarAlwaysRunFactor = cf.GetFloat(p, v); },
442 (s) => { return AvatarAlwaysRunFactor; }, 458 (s) => { return AvatarAlwaysRunFactor; },
443 (s,p,l,v) => { AvatarAlwaysRunFactor = v; } ), 459 (s,v) => { AvatarAlwaysRunFactor = v; } ),
444 new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 460 new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.",
445 3.5f, 461 3.5f,
446 (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); },
447 (s) => { return AvatarDensity; }, 462 (s) => { return AvatarDensity; },
448 (s,p,l,v) => { AvatarDensity = v; } ), 463 (s,v) => { AvatarDensity = v; } ),
449 new ParameterDefn("AvatarRestitution", "Bouncyness. Changed on avatar recreation.", 464 new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
450 0f, 465 0f,
451 (s,cf,p,v) => { AvatarRestitution = cf.GetFloat(p, v); },
452 (s) => { return AvatarRestitution; }, 466 (s) => { return AvatarRestitution; },
453 (s,p,l,v) => { AvatarRestitution = v; } ), 467 (s,v) => { AvatarRestitution = v; } ),
454 new ParameterDefn("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule", 468 new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
455 0.6f, 469 0.6f,
456 (s,cf,p,v) => { AvatarCapsuleWidth = cf.GetFloat(p, v); },
457 (s) => { return AvatarCapsuleWidth; }, 470 (s) => { return AvatarCapsuleWidth; },
458 (s,p,l,v) => { AvatarCapsuleWidth = v; } ), 471 (s,v) => { AvatarCapsuleWidth = v; } ),
459 new ParameterDefn("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule", 472 new ParameterDefn<float>("AvatarCapsuleDepth", "The distance between the front and back of the avatar capsule",
460 0.45f, 473 0.45f,
461 (s,cf,p,v) => { AvatarCapsuleDepth = cf.GetFloat(p, v); },
462 (s) => { return AvatarCapsuleDepth; }, 474 (s) => { return AvatarCapsuleDepth; },
463 (s,p,l,v) => { AvatarCapsuleDepth = v; } ), 475 (s,v) => { AvatarCapsuleDepth = v; } ),
464 new ParameterDefn("AvatarCapsuleHeight", "Default height of space around avatar", 476 new ParameterDefn<float>("AvatarCapsuleHeight", "Default height of space around avatar",
465 1.5f, 477 1.5f,
466 (s,cf,p,v) => { AvatarCapsuleHeight = cf.GetFloat(p, v); },
467 (s) => { return AvatarCapsuleHeight; }, 478 (s) => { return AvatarCapsuleHeight; },
468 (s,p,l,v) => { AvatarCapsuleHeight = v; } ), 479 (s,v) => { AvatarCapsuleHeight = v; } ),
469 new ParameterDefn("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 480 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
470 0.1f, 481 0.1f,
471 (s,cf,p,v) => { AvatarContactProcessingThreshold = cf.GetFloat(p, v); },
472 (s) => { return AvatarContactProcessingThreshold; }, 482 (s) => { return AvatarContactProcessingThreshold; },
473 (s,p,l,v) => { AvatarContactProcessingThreshold = v; } ), 483 (s,v) => { AvatarContactProcessingThreshold = v; } ),
474 new ParameterDefn("AvatarStepHeight", "Height of a step obstacle to consider step correction", 484 new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
475 0.3f, 485 0.3f,
476 (s,cf,p,v) => { AvatarStepHeight = cf.GetFloat(p, v); },
477 (s) => { return AvatarStepHeight; }, 486 (s) => { return AvatarStepHeight; },
478 (s,p,l,v) => { AvatarStepHeight = v; } ), 487 (s,v) => { AvatarStepHeight = v; } ),
479 new ParameterDefn("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)", 488 new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
480 0.6f, 489 0.6f,
481 (s,cf,p,v) => { AvatarStepApproachFactor = cf.GetFloat(p, v); },
482 (s) => { return AvatarStepApproachFactor; }, 490 (s) => { return AvatarStepApproachFactor; },
483 (s,p,l,v) => { AvatarStepApproachFactor = v; } ), 491 (s,v) => { AvatarStepApproachFactor = v; } ),
484 new ParameterDefn("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step", 492 new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
485 2.0f, 493 2.0f,
486 (s,cf,p,v) => { AvatarStepForceFactor = cf.GetFloat(p, v); },
487 (s) => { return AvatarStepForceFactor; }, 494 (s) => { return AvatarStepForceFactor; },
488 (s,p,l,v) => { AvatarStepForceFactor = v; } ), 495 (s,v) => { AvatarStepForceFactor = v; } ),
489 496
490 new ParameterDefn("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle", 497 new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
491 1000.0f, 498 1000.0f,
492 (s,cf,p,v) => { VehicleMaxLinearVelocity = cf.GetFloat(p, v); },
493 (s) => { return (float)VehicleMaxLinearVelocity; }, 499 (s) => { return (float)VehicleMaxLinearVelocity; },
494 (s,p,l,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ), 500 (s,v) => { VehicleMaxLinearVelocity = v; VehicleMaxLinearVelocitySq = v * v; } ),
495 new ParameterDefn("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle", 501 new ParameterDefn<float>("VehicleMaxAngularVelocity", "Maximum rotational velocity magnitude that can be assigned to a vehicle",
496 12.0f, 502 12.0f,
497 (s,cf,p,v) => { VehicleMaxAngularVelocity = cf.GetFloat(p, v); },
498 (s) => { return (float)VehicleMaxAngularVelocity; }, 503 (s) => { return (float)VehicleMaxAngularVelocity; },
499 (s,p,l,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ), 504 (s,v) => { VehicleMaxAngularVelocity = v; VehicleMaxAngularVelocitySq = v * v; } ),
500 new ParameterDefn("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)", 505 new ParameterDefn<float>("VehicleAngularDamping", "Factor to damp vehicle angular movement per second (0.0 - 1.0)",
501 0.0f, 506 0.0f,
502 (s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); },
503 (s) => { return VehicleAngularDamping; }, 507 (s) => { return VehicleAngularDamping; },
504 (s,p,l,v) => { VehicleAngularDamping = v; } ), 508 (s,v) => { VehicleAngularDamping = v; } ),
505 new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)", 509 new ParameterDefn<Vector3>("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (<0,0,0> to <1,1,1>)",
506 1.0f, 510 new Vector3(1f, 1f, 1f),
507 (s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); },
508 (s) => { return VehicleLinearFactor; }, 511 (s) => { return VehicleLinearFactor; },
509 (s,p,l,v) => { VehicleLinearFactor = v; VehicleLinearFactorV = new Vector3(v, v, v); } ), 512 (s,v) => { VehicleLinearFactor = v; } ),
510 new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)", 513 new ParameterDefn<Vector3>("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (<0,0,0> to <1,1,1>)",
511 1.0f, 514 new Vector3(1f, 1f, 1f),
512 (s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); },
513 (s) => { return VehicleAngularFactor; }, 515 (s) => { return VehicleAngularFactor; },
514 (s,p,l,v) => { VehicleAngularFactor = v; VehicleAngularFactorV = new Vector3(v, v, v); } ), 516 (s,v) => { VehicleAngularFactor = v; } ),
515 new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)", 517 new ParameterDefn<float>("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)",
516 0.0f, 518 0.0f,
517 (s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); },
518 (s) => { return VehicleFriction; }, 519 (s) => { return VehicleFriction; },
519 (s,p,l,v) => { VehicleFriction = v; } ), 520 (s,v) => { VehicleFriction = v; } ),
520 new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)", 521 new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
521 0.0f, 522 0.0f,
522 (s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); },
523 (s) => { return VehicleRestitution; }, 523 (s) => { return VehicleRestitution; },
524 (s,p,l,v) => { VehicleRestitution = v; } ), 524 (s,v) => { VehicleRestitution = v; } ),
525 new ParameterDefn("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)", 525 new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiple gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
526 0.2f, 526 0.2f,
527 (s,cf,p,v) => { VehicleGroundGravityFudge = cf.GetFloat(p, v); },
528 (s) => { return VehicleGroundGravityFudge; }, 527 (s) => { return VehicleGroundGravityFudge; },
529 (s,p,l,v) => { VehicleGroundGravityFudge = v; } ), 528 (s,v) => { VehicleGroundGravityFudge = v; } ),
530 new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging", 529 new ParameterDefn<bool>("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
531 ConfigurationParameters.numericFalse, 530 false,
532 (s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
533 (s) => { return VehicleDebuggingEnabled; }, 531 (s) => { return VehicleDebuggingEnabled; },
534 (s,p,l,v) => { VehicleDebuggingEnabled = v; } ), 532 (s,v) => { VehicleDebuggingEnabled = v; } ),
535 533
536 new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", 534 new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
537 0f, 535 0f,
538 (s,cf,p,v) => { MaxPersistantManifoldPoolSize = cf.GetFloat(p, v); },
539 (s) => { return MaxPersistantManifoldPoolSize; }, 536 (s) => { return MaxPersistantManifoldPoolSize; },
540 (s,p,l,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ), 537 (s,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ),
541 new ParameterDefn("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)", 538 new ParameterDefn<float>("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
542 0f, 539 0f,
543 (s,cf,p,v) => { MaxCollisionAlgorithmPoolSize = cf.GetFloat(p, v); },
544 (s) => { return MaxCollisionAlgorithmPoolSize; }, 540 (s) => { return MaxCollisionAlgorithmPoolSize; },
545 (s,p,l,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ), 541 (s,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ),
546 new ParameterDefn("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count", 542 new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
547 ConfigurationParameters.numericFalse, 543 false,
548 (s,cf,p,v) => { ShouldDisableContactPoolDynamicAllocation = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
549 (s) => { return ShouldDisableContactPoolDynamicAllocation; }, 544 (s) => { return ShouldDisableContactPoolDynamicAllocation; },
550 (s,p,l,v) => { ShouldDisableContactPoolDynamicAllocation = v; s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = v; } ), 545 (s,v) => { ShouldDisableContactPoolDynamicAllocation = v;
551 new ParameterDefn("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step", 546 s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ),
552 ConfigurationParameters.numericFalse, 547 new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
553 (s,cf,p,v) => { ShouldForceUpdateAllAabbs = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 548 false,
554 (s) => { return ShouldForceUpdateAllAabbs; }, 549 (s) => { return ShouldForceUpdateAllAabbs; },
555 (s,p,l,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = v; } ), 550 (s,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = NumericBool(v); } ),
556 new ParameterDefn("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction", 551 new ParameterDefn<bool>("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
557 ConfigurationParameters.numericTrue, 552 true,
558 (s,cf,p,v) => { ShouldRandomizeSolverOrder = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
559 (s) => { return ShouldRandomizeSolverOrder; }, 553 (s) => { return ShouldRandomizeSolverOrder; },
560 (s,p,l,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = v; } ), 554 (s,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = NumericBool(v); } ),
561 new ParameterDefn("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands", 555 new ParameterDefn<bool>("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
562 ConfigurationParameters.numericTrue, 556 true,
563 (s,cf,p,v) => { ShouldSplitSimulationIslands = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
564 (s) => { return ShouldSplitSimulationIslands; }, 557 (s) => { return ShouldSplitSimulationIslands; },
565 (s,p,l,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = v; } ), 558 (s,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = NumericBool(v); } ),
566 new ParameterDefn("ShouldEnableFrictionCaching", "Enable friction computation caching", 559 new ParameterDefn<bool>("ShouldEnableFrictionCaching", "Enable friction computation caching",
567 ConfigurationParameters.numericTrue, 560 true,
568 (s,cf,p,v) => { ShouldEnableFrictionCaching = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
569 (s) => { return ShouldEnableFrictionCaching; }, 561 (s) => { return ShouldEnableFrictionCaching; },
570 (s,p,l,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = v; } ), 562 (s,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = NumericBool(v); } ),
571 new ParameterDefn("NumberOfSolverIterations", "Number of internal iterations (0 means default)", 563 new ParameterDefn<float>("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
572 0f, // zero says use Bullet default 564 0f, // zero says use Bullet default
573 (s,cf,p,v) => { NumberOfSolverIterations = cf.GetFloat(p, v); },
574 (s) => { return NumberOfSolverIterations; }, 565 (s) => { return NumberOfSolverIterations; },
575 (s,p,l,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ), 566 (s,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ),
576 new ParameterDefn("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.", 567 new ParameterDefn<bool>("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.",
577 ConfigurationParameters.numericTrue, 568 true,
578 (s,cf,p,v) => { UseSingleSidedMeshesF = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); }, 569 (s) => { return UseSingleSidedMeshes; },
579 (s) => { return UseSingleSidedMeshesF; }, 570 (s,v) => { UseSingleSidedMeshes = v; s.UnmanagedParams[0].useSingleSidedMeshes = NumericBool(v); } ),
580 (s,p,l,v) => { UseSingleSidedMeshesF = v; s.UnmanagedParams[0].useSingleSidedMeshes = v; } ), 571 new ParameterDefn<float>("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))",
581 new ParameterDefn("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))",
582 0f, 572 0f,
583 (s,cf,p,v) => { GlobalContactBreakingThreshold = cf.GetFloat(p, v); },
584 (s) => { return GlobalContactBreakingThreshold; }, 573 (s) => { return GlobalContactBreakingThreshold; },
585 (s,p,l,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ), 574 (s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ),
586 575
587 new ParameterDefn("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)", 576 new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
588 (float)BSLinkset.LinksetImplementation.Compound, 577 (float)BSLinkset.LinksetImplementation.Compound,
589 (s,cf,p,v) => { LinksetImplementation = cf.GetFloat(p,v); },
590 (s) => { return LinksetImplementation; }, 578 (s) => { return LinksetImplementation; },
591 (s,p,l,v) => { LinksetImplementation = v; } ), 579 (s,v) => { LinksetImplementation = v; } ),
592 new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.", 580 new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
593 ConfigurationParameters.numericFalse, 581 false,
594 (s,cf,p,v) => { LinkConstraintUseFrameOffset = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
595 (s) => { return LinkConstraintUseFrameOffset; }, 582 (s) => { return LinkConstraintUseFrameOffset; },
596 (s,p,l,v) => { LinkConstraintUseFrameOffset = v; } ), 583 (s,v) => { LinkConstraintUseFrameOffset = v; } ),
597 new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints", 584 new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
598 ConfigurationParameters.numericTrue, 585 true,
599 (s,cf,p,v) => { LinkConstraintEnableTransMotor = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },
600 (s) => { return LinkConstraintEnableTransMotor; }, 586 (s) => { return LinkConstraintEnableTransMotor; },
601 (s,p,l,v) => { LinkConstraintEnableTransMotor = v; } ), 587 (s,v) => { LinkConstraintEnableTransMotor = v; } ),
602 new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints", 588 new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
603 5.0f, 589 5.0f,
604 (s,cf,p,v) => { LinkConstraintTransMotorMaxVel = cf.GetFloat(p, v); },
605 (s) => { return LinkConstraintTransMotorMaxVel; }, 590 (s) => { return LinkConstraintTransMotorMaxVel; },
606 (s,p,l,v) => { LinkConstraintTransMotorMaxVel = v; } ), 591 (s,v) => { LinkConstraintTransMotorMaxVel = v; } ),
607 new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints", 592 new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
608 0.1f, 593 0.1f,
609 (s,cf,p,v) => { LinkConstraintTransMotorMaxForce = cf.GetFloat(p, v); },
610 (s) => { return LinkConstraintTransMotorMaxForce; }, 594 (s) => { return LinkConstraintTransMotorMaxForce; },
611 (s,p,l,v) => { LinkConstraintTransMotorMaxForce = v; } ), 595 (s,v) => { LinkConstraintTransMotorMaxForce = v; } ),
612 new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1", 596 new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1",
613 0.1f, 597 0.1f,
614 (s,cf,p,v) => { LinkConstraintCFM = cf.GetFloat(p, v); },
615 (s) => { return LinkConstraintCFM; }, 598 (s) => { return LinkConstraintCFM; },
616 (s,p,l,v) => { LinkConstraintCFM = v; } ), 599 (s,v) => { LinkConstraintCFM = v; } ),
617 new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2", 600 new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2",
618 0.1f, 601 0.1f,
619 (s,cf,p,v) => { LinkConstraintERP = cf.GetFloat(p, v); },
620 (s) => { return LinkConstraintERP; }, 602 (s) => { return LinkConstraintERP; },
621 (s,p,l,v) => { LinkConstraintERP = v; } ), 603 (s,v) => { LinkConstraintERP = v; } ),
622 new ParameterDefn("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)", 604 new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)",
623 40, 605 40,
624 (s,cf,p,v) => { LinkConstraintSolverIterations = cf.GetFloat(p, v); },
625 (s) => { return LinkConstraintSolverIterations; }, 606 (s) => { return LinkConstraintSolverIterations; },
626 (s,p,l,v) => { LinkConstraintSolverIterations = v; } ), 607 (s,v) => { LinkConstraintSolverIterations = v; } ),
627 608
628 new ParameterDefn("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)", 609 new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
629 0f, 610 0,
630 (s,cf,p,v) => { s.PhysicsMetricDumpFrames = cf.GetFloat(p, (int)v); }, 611 (s) => { return s.PhysicsMetricDumpFrames; },
631 (s) => { return (float)s.PhysicsMetricDumpFrames; }, 612 (s,v) => { s.PhysicsMetricDumpFrames = v; } ),
632 (s,p,l,v) => { s.PhysicsMetricDumpFrames = (int)v; } ), 613 new ParameterDefn<float>("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool",
633 new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool",
634 0f, 614 0f,
635 (s,cf,p,v) => { ; },
636 (s) => { return 0f; }, 615 (s) => { return 0f; },
637 (s,p,l,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), 616 (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ),
638 new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", 617 new ParameterDefn<float>("ResetConstraintSolver", "Setting this is any value resets the constraint solver",
639 0f, 618 0f,
640 (s,cf,p,v) => { ; },
641 (s) => { return 0f; }, 619 (s) => { return 0f; },
642 (s,p,l,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ), 620 (s,v) => { BSParam.ResetConstraintSolverTainted(s, v); } ),
643 }; 621 };
644 622
645 // Convert a boolean to our numeric true and false values 623 // Convert a boolean to our numeric true and false values
@@ -658,13 +636,13 @@ public static class BSParam
658 // ParameterDefn structure. 636 // ParameterDefn structure.
659 // Case does not matter as names are compared after converting to lower case. 637 // Case does not matter as names are compared after converting to lower case.
660 // Returns 'false' if the parameter is not found. 638 // Returns 'false' if the parameter is not found.
661 internal static bool TryGetParameter(string paramName, out ParameterDefn defn) 639 internal static bool TryGetParameter(string paramName, out ParameterDefnBase defn)
662 { 640 {
663 bool ret = false; 641 bool ret = false;
664 ParameterDefn foundDefn = new ParameterDefn(); 642 ParameterDefnBase foundDefn = null;
665 string pName = paramName.ToLower(); 643 string pName = paramName.ToLower();
666 644
667 foreach (ParameterDefn parm in ParameterDefinitions) 645 foreach (ParameterDefnBase parm in ParameterDefinitions)
668 { 646 {
669 if (pName == parm.name.ToLower()) 647 if (pName == parm.name.ToLower())
670 { 648 {
@@ -680,18 +658,18 @@ public static class BSParam
680 // Pass through the settable parameters and set the default values 658 // Pass through the settable parameters and set the default values
681 internal static void SetParameterDefaultValues(BSScene physicsScene) 659 internal static void SetParameterDefaultValues(BSScene physicsScene)
682 { 660 {
683 foreach (ParameterDefn parm in ParameterDefinitions) 661 foreach (ParameterDefnBase parm in ParameterDefinitions)
684 { 662 {
685 parm.setter(physicsScene, parm.name, PhysParameterEntry.APPLY_TO_NONE, parm.defaultValue); 663 parm.AssignDefault(physicsScene);
686 } 664 }
687 } 665 }
688 666
689 // Get user set values out of the ini file. 667 // Get user set values out of the ini file.
690 internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg) 668 internal static void SetParameterConfigurationValues(BSScene physicsScene, IConfig cfg)
691 { 669 {
692 foreach (ParameterDefn parm in ParameterDefinitions) 670 foreach (ParameterDefnBase parm in ParameterDefinitions)
693 { 671 {
694 parm.userParam(physicsScene, cfg, parm.name, parm.defaultValue); 672 parm.SetValue(physicsScene, cfg.GetString(parm.name, parm.GetValue(physicsScene)));
695 } 673 }
696 } 674 }
697 675
@@ -706,11 +684,11 @@ public static class BSParam
706 List<PhysParameterEntry> entries = new List<PhysParameterEntry>(); 684 List<PhysParameterEntry> entries = new List<PhysParameterEntry>();
707 for (int ii = 0; ii < ParameterDefinitions.Length; ii++) 685 for (int ii = 0; ii < ParameterDefinitions.Length; ii++)
708 { 686 {
709 ParameterDefn pd = ParameterDefinitions[ii]; 687 ParameterDefnBase pd = ParameterDefinitions[ii];
710 entries.Add(new PhysParameterEntry(pd.name, pd.desc)); 688 entries.Add(new PhysParameterEntry(pd.name, pd.desc));
711 } 689 }
712 690
713 // make the list alphabetical for estetic reasons 691 // make the list alphabetical for ease of finding anything
714 entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); 692 entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); });
715 693
716 SettableParameters = entries.ToArray(); 694 SettableParameters = entries.ToArray();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 05722b8..e6aefd5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -161,7 +161,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
161 private int m_physicsLoggingFileMinutes; 161 private int m_physicsLoggingFileMinutes;
162 private bool m_physicsLoggingDoFlush; 162 private bool m_physicsLoggingDoFlush;
163 private bool m_physicsPhysicalDumpEnabled; 163 private bool m_physicsPhysicalDumpEnabled;
164 public float PhysicsMetricDumpFrames { get; set; } 164 public int PhysicsMetricDumpFrames { get; set; }
165 // 'true' of the vehicle code is to log lots of details 165 // 'true' of the vehicle code is to log lots of details
166 public bool VehicleLoggingEnabled { get; private set; } 166 public bool VehicleLoggingEnabled { get; private set; }
167 public bool VehiclePhysicalLoggingEnabled { get; private set; } 167 public bool VehiclePhysicalLoggingEnabled { get; private set; }
@@ -542,7 +542,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
542 collidersCount = 0; 542 collidersCount = 0;
543 } 543 }
544 544
545 if ((m_simulationStep % PhysicsMetricDumpFrames) == 0) 545 if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0))
546 PE.DumpPhysicsStatistics(World); 546 PE.DumpPhysicsStatistics(World);
547 547
548 // Get a value for 'now' so all the collision and update routines don't have to get their own. 548 // Get a value for 'now' so all the collision and update routines don't have to get their own.
@@ -880,38 +880,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
880 { 880 {
881 bool ret = false; 881 bool ret = false;
882 882
883 float valf = 0f; 883 BSParam.ParameterDefnBase theParam;
884 if (val.ToLower() == "true")
885 {
886 valf = PhysParameterEntry.NUMERIC_TRUE;
887 }
888 else
889 {
890 if (val.ToLower() == "false")
891 {
892 valf = PhysParameterEntry.NUMERIC_FALSE;
893 }
894 else
895 {
896 try
897 {
898 valf = float.Parse(val);
899 }
900 catch
901 {
902 valf = 0f;
903 }
904 }
905 }
906
907 BSParam.ParameterDefn theParam;
908 if (BSParam.TryGetParameter(parm, out theParam)) 884 if (BSParam.TryGetParameter(parm, out theParam))
909 { 885 {
910 // Set the value in the C# code 886 // Set the value in the C# code
911 theParam.setter(this, parm, localID, valf); 887 theParam.SetValue(this, val);
912 888
913 // Optionally set the parameter in the unmanaged code 889 // Optionally set the parameter in the unmanaged code
914 if (theParam.onObject != null) 890 if (theParam.HasSetOnObject)
915 { 891 {
916 // update all the localIDs specified 892 // update all the localIDs specified
917 // If the local ID is APPLY_TO_NONE, just change the default value 893 // If the local ID is APPLY_TO_NONE, just change the default value
@@ -923,16 +899,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
923 case PhysParameterEntry.APPLY_TO_NONE: 899 case PhysParameterEntry.APPLY_TO_NONE:
924 // This will cause a call into the physical world if some operation is specified (SetOnObject). 900 // This will cause a call into the physical world if some operation is specified (SetOnObject).
925 objectIDs.Add(TERRAIN_ID); 901 objectIDs.Add(TERRAIN_ID);
926 TaintedUpdateParameter(parm, objectIDs, valf); 902 TaintedUpdateParameter(parm, objectIDs, val);
927 break; 903 break;
928 case PhysParameterEntry.APPLY_TO_ALL: 904 case PhysParameterEntry.APPLY_TO_ALL:
929 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); 905 lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
930 TaintedUpdateParameter(parm, objectIDs, valf); 906 TaintedUpdateParameter(parm, objectIDs, val);
931 break; 907 break;
932 default: 908 default:
933 // setting only one localID 909 // setting only one localID
934 objectIDs.Add(localID); 910 objectIDs.Add(localID);
935 TaintedUpdateParameter(parm, objectIDs, valf); 911 TaintedUpdateParameter(parm, objectIDs, val);
936 break; 912 break;
937 } 913 }
938 } 914 }
@@ -943,22 +919,22 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
943 } 919 }
944 920
945 // schedule the actual updating of the paramter to when the phys engine is not busy 921 // schedule the actual updating of the paramter to when the phys engine is not busy
946 private void TaintedUpdateParameter(string parm, List<uint> lIDs, float val) 922 private void TaintedUpdateParameter(string parm, List<uint> lIDs, string val)
947 { 923 {
948 float xval = val; 924 string xval = val;
949 List<uint> xlIDs = lIDs; 925 List<uint> xlIDs = lIDs;
950 string xparm = parm; 926 string xparm = parm;
951 TaintedObject("BSScene.UpdateParameterSet", delegate() { 927 TaintedObject("BSScene.UpdateParameterSet", delegate() {
952 BSParam.ParameterDefn thisParam; 928 BSParam.ParameterDefnBase thisParam;
953 if (BSParam.TryGetParameter(xparm, out thisParam)) 929 if (BSParam.TryGetParameter(xparm, out thisParam))
954 { 930 {
955 if (thisParam.onObject != null) 931 if (thisParam.HasSetOnObject)
956 { 932 {
957 foreach (uint lID in xlIDs) 933 foreach (uint lID in xlIDs)
958 { 934 {
959 BSPhysObject theObject = null; 935 BSPhysObject theObject = null;
960 if (PhysObjects.TryGetValue(lID, out theObject)) 936 if (PhysObjects.TryGetValue(lID, out theObject))
961 thisParam.onObject(this, theObject, xval); 937 thisParam.SetOnObject(this, theObject);
962 } 938 }
963 } 939 }
964 } 940 }
@@ -971,10 +947,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
971 { 947 {
972 string val = String.Empty; 948 string val = String.Empty;
973 bool ret = false; 949 bool ret = false;
974 BSParam.ParameterDefn theParam; 950 BSParam.ParameterDefnBase theParam;
975 if (BSParam.TryGetParameter(parm, out theParam)) 951 if (BSParam.TryGetParameter(parm, out theParam))
976 { 952 {
977 val = theParam.getter(this).ToString(); 953 val = theParam.GetValue(this);
978 ret = true; 954 ret = true;
979 } 955 }
980 value = val; 956 value = val;