diff options
Diffstat (limited to 'OpenSim')
4 files changed, 44 insertions, 21 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index 2f88e2b..ef106bd 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -399,13 +399,15 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
399 | [ScriptConstant] | 399 | [ScriptConstant] |
400 | public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415; | 400 | public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415; |
401 | [ScriptConstant] | 401 | [ScriptConstant] |
402 | public const int PHYS_PARAM_SPRING_DAMPING = 14416; | 402 | public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416; |
403 | [ScriptConstant] | 403 | [ScriptConstant] |
404 | public const int PHYS_PARAM_SPRING_STIFFNESS = 14417; | 404 | public const int PHYS_PARAM_SPRING_DAMPING = 14417; |
405 | [ScriptConstant] | 405 | [ScriptConstant] |
406 | public const int PHYS_PARAM_LINK_TYPE = 14418; | 406 | public const int PHYS_PARAM_SPRING_STIFFNESS = 14418; |
407 | [ScriptConstant] | ||
408 | public const int PHYS_PARAM_LINK_TYPE = 14419; | ||
407 | 409 | ||
408 | public const int PHYS_PARAM_MAX = 14418; | 410 | public const int PHYS_PARAM_MAX = 14419; |
409 | 411 | ||
410 | // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) | 412 | // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) |
411 | [ScriptInvocation] | 413 | [ScriptInvocation] |
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; |