diff options
author | Robert Adams | 2013-09-09 14:53:16 -0700 |
---|---|---|
committer | Robert Adams | 2013-09-11 09:12:19 -0700 |
commit | c5eabb28b4c933cfacefa85381e290372fbc094e (patch) | |
tree | c79acadaa6de935d18865a1bc0d5c9162e23747a /OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |
parent | BulletSim: add extended physics LSL constants for axis specification. (diff) | |
download | opensim-SC_OLD-c5eabb28b4c933cfacefa85381e290372fbc094e.zip opensim-SC_OLD-c5eabb28b4c933cfacefa85381e290372fbc094e.tar.gz opensim-SC_OLD-c5eabb28b4c933cfacefa85381e290372fbc094e.tar.bz2 opensim-SC_OLD-c5eabb28b4c933cfacefa85381e290372fbc094e.tar.xz |
BulletSim: add LSL function and plumbing for setting a spring
equilibrium point in the physics engine constraint.
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index b3347bf..aaf92c8 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -63,6 +63,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
63 | public bool[] springAxisEnable; | 63 | public bool[] springAxisEnable; |
64 | public float[] springDamping; | 64 | public float[] springDamping; |
65 | public float[] springStiffness; | 65 | public float[] springStiffness; |
66 | public OMV.Vector3 springLinearEquilibriumPoint; | ||
67 | public OMV.Vector3 springAngularEquilibriumPoint; | ||
66 | 68 | ||
67 | public BSLinkInfoConstraint(BSPrimLinkable pMember) | 69 | public BSLinkInfoConstraint(BSPrimLinkable pMember) |
68 | : base(pMember) | 70 | : base(pMember) |
@@ -102,6 +104,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
102 | springDamping[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED; | 104 | springDamping[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED; |
103 | springStiffness[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED; | 105 | springStiffness[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED; |
104 | } | 106 | } |
107 | springLinearEquilibriumPoint = OMV.Vector3.Zero; | ||
108 | springAngularEquilibriumPoint = OMV.Vector3.Zero; | ||
105 | member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID); | 109 | member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID); |
106 | } | 110 | } |
107 | 111 | ||
@@ -155,7 +159,12 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
155 | if (springStiffness[ii] != BSAPITemplate.SPRING_NOT_SPECIFIED) | 159 | if (springStiffness[ii] != BSAPITemplate.SPRING_NOT_SPECIFIED) |
156 | constrainSpring.SetStiffness(ii, springStiffness[ii]); | 160 | constrainSpring.SetStiffness(ii, springStiffness[ii]); |
157 | } | 161 | } |
158 | constrainSpring.SetEquilibriumPoint(BSAPITemplate.SPRING_NOT_SPECIFIED, BSAPITemplate.SPRING_NOT_SPECIFIED); | 162 | constrainSpring.CalculateTransforms(); |
163 | |||
164 | if (springLinearEquilibriumPoint != OMV.Vector3.Zero) | ||
165 | constrainSpring.SetEquilibriumPoint(springLinearEquilibriumPoint, springAngularEquilibriumPoint); | ||
166 | else | ||
167 | constrainSpring.SetEquilibriumPoint(BSAPITemplate.SPRING_NOT_SPECIFIED, BSAPITemplate.SPRING_NOT_SPECIFIED); | ||
159 | } | 168 | } |
160 | break; | 169 | break; |
161 | default: | 170 | default: |
@@ -618,6 +627,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
618 | float valueFloat; | 627 | float valueFloat; |
619 | bool valueBool; | 628 | bool valueBool; |
620 | OMV.Vector3 valueVector; | 629 | OMV.Vector3 valueVector; |
630 | OMV.Vector3 valueVector2; | ||
621 | OMV.Quaternion valueQuaternion; | 631 | OMV.Quaternion valueQuaternion; |
622 | int axisLow, axisHigh; | 632 | int axisLow, axisHigh; |
623 | 633 | ||
@@ -764,6 +774,14 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
764 | linkInfo.springStiffness[ii] = valueFloat; | 774 | linkInfo.springStiffness[ii] = valueFloat; |
765 | opIndex += 3; | 775 | opIndex += 3; |
766 | break; | 776 | break; |
777 | case ExtendedPhysics.PHYS_PARAM_SPRING_EQUILIBRIUM_POINT: | ||
778 | errMsg = "PHYS_PARAM_SPRING_EQUILIBRIUM_POINT takes two parameters of type vector"; | ||
779 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; | ||
780 | valueVector2 = (OMV.Vector3)pParams[opIndex + 2]; | ||
781 | linkInfo.springLinearEquilibriumPoint = valueVector; | ||
782 | linkInfo.springAngularEquilibriumPoint = valueVector2; | ||
783 | opIndex += 3; | ||
784 | break; | ||
767 | case ExtendedPhysics.PHYS_PARAM_USE_LINEAR_FRAMEA: | 785 | case ExtendedPhysics.PHYS_PARAM_USE_LINEAR_FRAMEA: |
768 | errMsg = "PHYS_PARAM_USE_LINEAR_FRAMEA takes one parameter of type integer (bool)"; | 786 | errMsg = "PHYS_PARAM_USE_LINEAR_FRAMEA takes one parameter of type integer (bool)"; |
769 | valueBool = ((int)pParams[opIndex + 1]) != 0; | 787 | valueBool = ((int)pParams[opIndex + 1]) != 0; |