aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2012-07-25 14:52:17 -0700
committerRobert Adams2012-07-25 16:31:08 -0700
commitd7add2940a38437e748ca74163bbf37acecfa04c (patch)
tree9628de187941813fc3f9cf3348786c43dd6c50c6
parentBulletSim: small change to use the pointer to the bullet object for zeroing f... (diff)
downloadopensim-SC_OLD-d7add2940a38437e748ca74163bbf37acecfa04c.zip
opensim-SC_OLD-d7add2940a38437e748ca74163bbf37acecfa04c.tar.gz
opensim-SC_OLD-d7add2940a38437e748ca74163bbf37acecfa04c.tar.bz2
opensim-SC_OLD-d7add2940a38437e748ca74163bbf37acecfa04c.tar.xz
BulletSim: add parameters for setting linkset constraint factors
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs24
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs25
-rw-r--r--bin/OpenSimDefaults.ini6
3 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 6c8ae2e..3be28e3 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1295,10 +1295,9 @@ public sealed class BSPrim : PhysicsActor
1295 // relative to each other. 1295 // relative to each other.
1296 void CreateLinkset() 1296 void CreateLinkset()
1297 { 1297 {
1298 DebugLog("{0}: CreateLinkset. Root prim={1}, prims={2}", LogHeader, LocalID, _childrenPrims.Count+1); 1298 // DebugLog("{0}: CreateLinkset. Root prim={1}, prims={2}", LogHeader, LocalID, _childrenPrims.Count+1);
1299 1299
1300 // remove any constraints that might be in place 1300 // remove any constraints that might be in place
1301 DebugLog("{0}: CreateLinkset: RemoveConstraints between me and any children", LogHeader, LocalID);
1302 UnlinkAllChildren(); 1301 UnlinkAllChildren();
1303 1302
1304 // create constraints between the root prim and each of the children 1303 // create constraints between the root prim and each of the children
@@ -1324,18 +1323,8 @@ public sealed class BSPrim : PhysicsActor
1324 1323
1325 // create a constraint that allows no freedom of movement between the two objects 1324 // create a constraint that allows no freedom of movement between the two objects
1326 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 1325 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
1327 DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID); 1326 // DebugLog("{0}: CreateLinkset: Adding a constraint between root prim {1} and child prim {2}", LogHeader, LocalID, childPrim.LocalID);
1328 DetailLog("{0},LinkAChildToMe,taint,root={1},child={2}", LocalID, LocalID, childPrim.LocalID); 1327 DetailLog("{0},LinkAChildToMe,taint,root={1},child={2}", LocalID, LocalID, childPrim.LocalID);
1329 /*
1330 BulletSimAPI.AddConstraint(_scene.WorldID, LocalID, childPrim.LocalID,
1331 childRelativePosition,
1332 childRelativeRotation,
1333 OMV.Vector3.Zero,
1334 OMV.Quaternion.Identity,
1335 OMV.Vector3.Zero, OMV.Vector3.Zero,
1336 OMV.Vector3.Zero, OMV.Vector3.Zero);
1337 */
1338 // BSConstraint constrain = new BSConstraint(_scene.World, this.Body, childPrim.Body,
1339 BSConstraint constrain = _scene.Constraints.CreateConstraint( 1328 BSConstraint constrain = _scene.Constraints.CreateConstraint(
1340 _scene.World, this.Body, childPrim.Body, 1329 _scene.World, this.Body, childPrim.Body,
1341 childRelativePosition, 1330 childRelativePosition,
@@ -1346,8 +1335,13 @@ public sealed class BSPrim : PhysicsActor
1346 constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero); 1335 constrain.SetAngularLimits(OMV.Vector3.Zero, OMV.Vector3.Zero);
1347 1336
1348 // tweek the constraint to increase stability 1337 // tweek the constraint to increase stability
1349 constrain.UseFrameOffset(true); 1338 constrain.UseFrameOffset(_scene.BoolNumeric(_scene.Params.linkConstraintUseFrameOffset));
1350 constrain.TranslationalLimitMotor(true, 5f, 0.1f); 1339 if (_scene.BoolNumeric(_scene.Params.linkConstraintEnableTransMotor))
1340 {
1341 constrain.TranslationalLimitMotor(true,
1342 _scene.Params.linkConstraintTransMotorMaxVel,
1343 _scene.Params.linkConstraintTransMotorMaxForce);
1344 }
1351 } 1345 }
1352 1346
1353 // Remove linkage between myself and a particular child 1347 // Remove linkage between myself and a particular child
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 07a377b..a1587a8 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -1025,6 +1025,27 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1025 (s) => { return s.m_params[0].numberOfSolverIterations; }, 1025 (s) => { return s.m_params[0].numberOfSolverIterations; },
1026 (s,p,l,v) => { s.m_params[0].numberOfSolverIterations = v; } ), 1026 (s,p,l,v) => { s.m_params[0].numberOfSolverIterations = v; } ),
1027 1027
1028 new ParameterDefn("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
1029 ConfigurationParameters.numericTrue,
1030 (s,cf,p,v) => { s.m_params[0].linkConstraintUseFrameOffset = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
1031 (s) => { return s.m_params[0].linkConstraintUseFrameOffset; },
1032 (s,p,l,v) => { s.m_params[0].linkConstraintUseFrameOffset = v; } ),
1033 new ParameterDefn("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
1034 ConfigurationParameters.numericTrue,
1035 (s,cf,p,v) => { s.m_params[0].linkConstraintEnableTransMotor = s.NumericBool(cf.GetBoolean(p, s.BoolNumeric(v))); },
1036 (s) => { return s.m_params[0].linkConstraintEnableTransMotor; },
1037 (s,p,l,v) => { s.m_params[0].linkConstraintEnableTransMotor = v; } ),
1038 new ParameterDefn("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
1039 5.0f,
1040 (s,cf,p,v) => { s.m_params[0].linkConstraintTransMotorMaxVel = cf.GetFloat(p, v); },
1041 (s) => { return s.m_params[0].linkConstraintTransMotorMaxVel; },
1042 (s,p,l,v) => { s.m_params[0].linkConstraintTransMotorMaxVel = v; } ),
1043 new ParameterDefn("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
1044 0.1f,
1045 (s,cf,p,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = cf.GetFloat(p, v); },
1046 (s) => { return s.m_params[0].linkConstraintTransMotorMaxForce; },
1047 (s,p,l,v) => { s.m_params[0].linkConstraintTransMotorMaxForce = v; } ),
1048
1028 new ParameterDefn("DetailedStats", "Frames between outputting detailed phys stats. (0 is off)", 1049 new ParameterDefn("DetailedStats", "Frames between outputting detailed phys stats. (0 is off)",
1029 0f, 1050 0f,
1030 (s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); }, 1051 (s,cf,p,v) => { s.m_detailedStatsStep = cf.GetInt(p, (int)v); },
@@ -1039,13 +1060,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters
1039 }; 1060 };
1040 1061
1041 // Convert a boolean to our numeric true and false values 1062 // Convert a boolean to our numeric true and false values
1042 protected float NumericBool(bool b) 1063 public float NumericBool(bool b)
1043 { 1064 {
1044 return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse); 1065 return (b ? ConfigurationParameters.numericTrue : ConfigurationParameters.numericFalse);
1045 } 1066 }
1046 1067
1047 // Convert numeric true and false values to a boolean 1068 // Convert numeric true and false values to a boolean
1048 protected bool BoolNumeric(float b) 1069 public bool BoolNumeric(float b)
1049 { 1070 {
1050 return (b == ConfigurationParameters.numericTrue ? true : false); 1071 return (b == ConfigurationParameters.numericTrue ? true : false);
1051 } 1072 }
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index ededdc05..5935ca1 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -914,6 +914,12 @@
914 ShouldEnableFrictionCaching = False; 914 ShouldEnableFrictionCaching = False;
915 NumberOfSolverIterations = 0; 915 NumberOfSolverIterations = 0;
916 916
917 ; Linkset constraint parameters
918 LinkConstraintUseFrameOffset = True;
919 LinkConstraintEnableTransMotor = True;
920 LinkConstraintTransMotorMaxVel = 5.0;
921 LinkConstraintTransMotorMaxForce = 0.1;
922
917 923
918 ; Whether to mesh sculpties 924 ; Whether to mesh sculpties
919 MeshSculptedPrim = true 925 MeshSculptedPrim = true