aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
diff options
context:
space:
mode:
authorRobert Adams2012-07-31 09:23:05 -0700
committerRobert Adams2012-07-31 09:23:05 -0700
commit50dbb9ffe480b08f13f7bebb8259193dc00f88dd (patch)
tree20a35e254d4ec9180b75af2e0a02e61dec53e028 /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-50dbb9ffe480b08f13f7bebb8259193dc00f88dd.zip
opensim-SC_OLD-50dbb9ffe480b08f13f7bebb8259193dc00f88dd.tar.gz
opensim-SC_OLD-50dbb9ffe480b08f13f7bebb8259193dc00f88dd.tar.bz2
opensim-SC_OLD-50dbb9ffe480b08f13f7bebb8259193dc00f88dd.tar.xz
BulletSim: add parameters and API calls for setting ERP and CFM.
Set ERP and CFM in linkset constraints. Reorder rebuilding of object bodies so they are not rebuilt everytime something is linked and unlinked.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs34
1 files changed, 33 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index c6d622b..28d5cb5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -315,6 +315,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
315 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying) 315 public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 size, bool isFlying)
316 { 316 {
317 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); 317 // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName);
318
319 if (!m_initialized) return null;
320
318 BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying); 321 BSCharacter actor = new BSCharacter(localID, avName, this, position, size, isFlying);
319 lock (m_avatars) m_avatars.Add(localID, actor); 322 lock (m_avatars) m_avatars.Add(localID, actor);
320 return actor; 323 return actor;
@@ -323,6 +326,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
323 public override void RemoveAvatar(PhysicsActor actor) 326 public override void RemoveAvatar(PhysicsActor actor)
324 { 327 {
325 // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); 328 // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader);
329
330 if (!m_initialized) return;
331
326 BSCharacter bsactor = actor as BSCharacter; 332 BSCharacter bsactor = actor as BSCharacter;
327 if (bsactor != null) 333 if (bsactor != null)
328 { 334 {
@@ -341,6 +347,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters
341 347
342 public override void RemovePrim(PhysicsActor prim) 348 public override void RemovePrim(PhysicsActor prim)
343 { 349 {
350 if (!m_initialized) return;
351
344 BSPrim bsprim = prim as BSPrim; 352 BSPrim bsprim = prim as BSPrim;
345 if (bsprim != null) 353 if (bsprim != null)
346 { 354 {
@@ -366,6 +374,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters
366 Vector3 size, Quaternion rotation, bool isPhysical, uint localID) 374 Vector3 size, Quaternion rotation, bool isPhysical, uint localID)
367 { 375 {
368 // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName); 376 // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName);
377
378 if (!m_initialized) return null;
379
369 BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical); 380 BSPrim prim = new BSPrim(localID, primName, this, position, size, rotation, pbs, isPhysical);
370 lock (m_prims) m_prims.Add(localID, prim); 381 lock (m_prims) m_prims.Add(localID, prim);
371 return prim; 382 return prim;
@@ -807,6 +818,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
807 818
808 // List of all of the externally visible parameters. 819 // List of all of the externally visible parameters.
809 // For each parameter, this table maps a text name to getter and setters. 820 // For each parameter, this table maps a text name to getter and setters.
821 // To add a new externally referencable/settable parameter, add the paramter storage
822 // location somewhere in the program and make an entry in this table with the
823 // getters and setters.
824 // To add a new variable, it is easiest to find an existing definition and copy it.
825 // Parameter values are floats. Booleans are converted to a floating value.
826 //
810 // A ParameterDefn() takes the following parameters: 827 // A ParameterDefn() takes the following parameters:
811 // -- the text name of the parameter. This is used for console input and ini file. 828 // -- the text name of the parameter. This is used for console input and ini file.
812 // -- a short text description of the parameter. This shows up in the console listing. 829 // -- a short text description of the parameter. This shows up in the console listing.
@@ -815,7 +832,12 @@ public class BSScene : PhysicsScene, IPhysicsParameters
815 // -- a delegate for getting the value as a float 832 // -- a delegate for getting the value as a float
816 // -- a delegate for setting the value from a float 833 // -- a delegate for setting the value from a float
817 // 834 //
818 // To add a new variable, it is best to find an existing definition and copy it. 835 // The single letter parameters for the delegates are:
836 // s = BSScene
837 // p = string parameter name
838 // l = localID of referenced object
839 // v = float value
840 // cf = parameter configuration class (for fetching values from ini file)
819 private ParameterDefn[] ParameterDefinitions = 841 private ParameterDefn[] ParameterDefinitions =
820 { 842 {
821 new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties", 843 new ParameterDefn("MeshSculptedPrim", "Whether to create meshes for sculpties",
@@ -1048,6 +1070,16 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1048 (s,cf,p,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = cf.GetFloat(p, v); }, 1070 (s,cf,p,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = cf.GetFloat(p, v); },
1049 (s) => { return s.m_params[0].linkConstraintTransMotorMaxForce; }, 1071 (s) => { return s.m_params[0].linkConstraintTransMotorMaxForce; },
1050 (s,p,l,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = v; } ), 1072 (s,p,l,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = v; } ),
1073 new ParameterDefn("LinkConstraintCFM", "Amount constraint can be violated. 0=none, 1=all. Default=0",
1074 0.0f,
1075 (s,cf,p,v) => { s.m_params[0].linkConstraintCFM = cf.GetFloat(p, v); },
1076 (s) => { return s.m_params[0].linkConstraintCFM; },
1077 (s,p,l,v) => { s.m_params[0].linkConstraintCFM = v; } ),
1078 new ParameterDefn("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2",
1079 0.2f,
1080 (s,cf,p,v) => { s.m_params[0].linkConstraintERP = cf.GetFloat(p, v); },
1081 (s) => { return s.m_params[0].linkConstraintERP; },
1082 (s,p,l,v) => { s.m_params[0].linkConstraintERP = v; } ),
1051 1083
1052 new ParameterDefn("DetailedStats", "Frames between outputting detailed phys stats. (0 is off)", 1084 new ParameterDefn("DetailedStats", "Frames between outputting detailed phys stats. (0 is off)",
1053 0f, 1085 0f,