aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs51
1 files changed, 36 insertions, 15 deletions
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;