aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
authorRobert Adams2013-08-22 16:31:17 -0700
committerJustin Clark-Casey (justincc)2013-09-20 21:03:34 +0100
commit7a9eb26b00b2217c5d50607e52db73d08debd6f8 (patch)
treeea0c1e906005fd88b1bad0e726d7fccf2466b647 /OpenSim/Region/Physics/BulletSPlugin
parentBulletSim: implementation of setting spring specific physical parameters. Add... (diff)
downloadopensim-SC_OLD-7a9eb26b00b2217c5d50607e52db73d08debd6f8.zip
opensim-SC_OLD-7a9eb26b00b2217c5d50607e52db73d08debd6f8.tar.gz
opensim-SC_OLD-7a9eb26b00b2217c5d50607e52db73d08debd6f8.tar.bz2
opensim-SC_OLD-7a9eb26b00b2217c5d50607e52db73d08debd6f8.tar.xz
BulletSim: add axis parameter for specifying enable, damping, and stiffness for spring constraints. Renumber parameter ops since I can as no one is using them yet.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs51
3 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
index 9d8838b..0b3f467 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs
@@ -292,7 +292,7 @@ public enum ConstraintParamAxis : int
292 AXIS_ANGULAR_X, 292 AXIS_ANGULAR_X,
293 AXIS_ANGULAR_Y, 293 AXIS_ANGULAR_Y,
294 AXIS_ANGULAR_Z, 294 AXIS_ANGULAR_Z,
295 AXIS_LINEAR_ALL = 20, // these last three added by BulletSim so we don't have to do zillions of calls 295 AXIS_LINEAR_ALL = 20, // added by BulletSim so we don't have to do zillions of calls
296 AXIS_ANGULAR_ALL, 296 AXIS_ANGULAR_ALL,
297 AXIS_ALL 297 AXIS_ALL
298}; 298};
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
index 410584d..432e5b2 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
@@ -53,7 +53,7 @@ public sealed class BSConstraintSpring : BSConstraint6Dof
53 m_body1.ID, frame1Loc, frame1Rot, frame2Loc, frame2Rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); 53 m_body1.ID, frame1Loc, frame1Rot, frame2Loc, frame2Rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
54 } 54 }
55 55
56 public bool SetEnable(int pIndex, bool pAxisEnable) 56 public bool SetAxisEnable(int pIndex, bool pAxisEnable)
57 { 57 {
58 PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEnable,obj1ID={1},obj2ID={2},indx={3},enable={4}", 58 PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEnable,obj1ID={1},obj2ID={2},indx={3},enable={4}",
59 m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pAxisEnable); 59 m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pAxisEnable);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index be97c29..f623231 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -59,8 +59,9 @@ public sealed class BSLinksetConstraints : BSLinkset
59 public OMV.Vector3 frameInBloc; 59 public OMV.Vector3 frameInBloc;
60 public OMV.Quaternion frameInBrot; 60 public OMV.Quaternion frameInBrot;
61 // Spring 61 // Spring
62 public float springDamping; 62 public bool[] springAxisEnable;
63 public float springStiffness; 63 public float[] springDamping;
64 public float[] springStiffness;
64 65
65 public BSLinkInfoConstraint(BSPrimLinkable pMember) 66 public BSLinkInfoConstraint(BSPrimLinkable pMember)
66 : base(pMember) 67 : base(pMember)
@@ -90,8 +91,15 @@ public sealed class BSLinksetConstraints : BSLinkset
90 frameInArot = OMV.Quaternion.Identity; 91 frameInArot = OMV.Quaternion.Identity;
91 frameInBloc = OMV.Vector3.Zero; 92 frameInBloc = OMV.Vector3.Zero;
92 frameInBrot = OMV.Quaternion.Identity; 93 frameInBrot = OMV.Quaternion.Identity;
93 springDamping = -1f; 94 springAxisEnable = new bool[6];
94 springStiffness = -1f; 95 springDamping = new float[6];
96 springStiffness = new float[6];
97 for (int ii = 0; ii < springAxisEnable.Length; ii++)
98 {
99 springAxisEnable[ii] = false;
100 springDamping[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
101 springStiffness[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
102 }
95 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID); 103 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID);
96 } 104 }
97 105
@@ -139,11 +147,13 @@ public sealed class BSLinksetConstraints : BSLinkset
139 } 147 }
140 for (int ii = 0; ii < 6; ii++) 148 for (int ii = 0; ii < 6; ii++)
141 { 149 {
142 if (springDamping != -1) 150 constrainSpring.SetAxisEnable(ii, springAxisEnable[ii]);
143 constrainSpring.SetDamping(ii, springDamping); 151 if (springDamping[ii] != BSAPITemplate.SPRING_NOT_SPECIFIED)
144 if (springStiffness != -1) 152 constrainSpring.SetDamping(ii, springDamping[ii]);
145 constrainSpring.SetStiffness(ii, springStiffness); 153 if (springStiffness[ii] != BSAPITemplate.SPRING_NOT_SPECIFIED)
154 constrainSpring.SetStiffness(ii, springStiffness[ii]);
146 } 155 }
156 constrainSpring.SetEquilibriumPoint(BSAPITemplate.SPRING_NOT_SPECIFIED, BSAPITemplate.SPRING_NOT_SPECIFIED);
147 } 157 }
148 break; 158 break;
149 default: 159 default:
@@ -707,15 +717,26 @@ public sealed class BSLinksetConstraints : BSLinkset
707 linkInfo.solverIterations = valueFloat; 717 linkInfo.solverIterations = valueFloat;
708 opIndex += 2; 718 opIndex += 2;
709 break; 719 break;
720 case ExtendedPhysics.PHYS_PARAM_SPRING_AXIS_ENABLE:
721 valueInt = (int)pParams[opIndex + 1];
722 valueBool = ((int)pParams[opIndex + 2] != 0);
723 if (valueInt >=0 && valueInt < linkInfo.springAxisEnable.Length)
724 linkInfo.springAxisEnable[valueInt] = valueBool;
725 opIndex += 3;
726 break;
710 case ExtendedPhysics.PHYS_PARAM_SPRING_DAMPING: 727 case ExtendedPhysics.PHYS_PARAM_SPRING_DAMPING:
711 valueFloat = (float)pParams[opIndex + 1]; 728 valueInt = (int)pParams[opIndex + 1];
712 linkInfo.springDamping = valueFloat; 729 valueFloat = (float)pParams[opIndex + 2];
713 opIndex += 2; 730 if (valueInt >=0 && valueInt < linkInfo.springDamping.Length)
731 linkInfo.springDamping[valueInt] = valueFloat;
732 opIndex += 3;
714 break; 733 break;
715 case ExtendedPhysics.PHYS_PARAM_SPRING_STIFFNESS: 734 case ExtendedPhysics.PHYS_PARAM_SPRING_STIFFNESS:
716 valueFloat = (float)pParams[opIndex + 1]; 735 valueInt = (int)pParams[opIndex + 1];
717 linkInfo.springStiffness = valueFloat; 736 valueFloat = (float)pParams[opIndex + 2];
718 opIndex += 2; 737 if (valueInt >=0 && valueInt < linkInfo.springStiffness.Length)
738 linkInfo.springStiffness[valueInt] = valueFloat;
739 opIndex += 3;
719 break; 740 break;
720 default: 741 default:
721 break; 742 break;