diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | 102 |
1 files changed, 99 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index db323c2..17fec9d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -60,8 +60,6 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
60 | public float springDamping; | 60 | public float springDamping; |
61 | public float springStiffness; | 61 | public float springStiffness; |
62 | 62 | ||
63 | |||
64 | |||
65 | public BSLinkInfoConstraint(BSPrimLinkable pMember) | 63 | public BSLinkInfoConstraint(BSPrimLinkable pMember) |
66 | : base(pMember) | 64 | : base(pMember) |
67 | { | 65 | { |
@@ -72,7 +70,8 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
72 | // Set all the parameters for this constraint to a fixed, non-movable constraint. | 70 | // Set all the parameters for this constraint to a fixed, non-movable constraint. |
73 | public override void ResetLink() | 71 | public override void ResetLink() |
74 | { | 72 | { |
75 | constraintType = ConstraintType.D6_CONSTRAINT_TYPE; | 73 | // constraintType = ConstraintType.D6_CONSTRAINT_TYPE; |
74 | constraintType = ConstraintType.FIXED_CONSTRAINT_TYPE; | ||
76 | linearLimitLow = OMV.Vector3.Zero; | 75 | linearLimitLow = OMV.Vector3.Zero; |
77 | linearLimitHigh = OMV.Vector3.Zero; | 76 | linearLimitHigh = OMV.Vector3.Zero; |
78 | angularLimitLow = OMV.Vector3.Zero; | 77 | angularLimitLow = OMV.Vector3.Zero; |
@@ -97,6 +96,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
97 | { | 96 | { |
98 | switch (constraintType) | 97 | switch (constraintType) |
99 | { | 98 | { |
99 | case ConstraintType.FIXED_CONSTRAINT_TYPE: | ||
100 | case ConstraintType.D6_CONSTRAINT_TYPE: | 100 | case ConstraintType.D6_CONSTRAINT_TYPE: |
101 | BSConstraint6Dof constrain6dof = constrain as BSConstraint6Dof; | 101 | BSConstraint6Dof constrain6dof = constrain as BSConstraint6Dof; |
102 | if (constrain6dof != null) | 102 | if (constrain6dof != null) |
@@ -145,6 +145,20 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
145 | break; | 145 | break; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | |||
149 | // Return 'true' if the property updates from the physics engine should be reported | ||
150 | // to the simulator. | ||
151 | // If the constraint is fixed, we don't need to report as the simulator and viewer will | ||
152 | // report the right things. | ||
153 | public override bool ShouldUpdateChildProperties() | ||
154 | { | ||
155 | bool ret = true; | ||
156 | |||
157 | if (constraintType == ConstraintType.FIXED_CONSTRAINT_TYPE) | ||
158 | ret = false; | ||
159 | |||
160 | return ret; | ||
161 | } | ||
148 | } | 162 | } |
149 | 163 | ||
150 | public BSLinksetConstraints(BSScene scene, BSPrimLinkable parent) : base(scene, parent) | 164 | public BSLinksetConstraints(BSScene scene, BSPrimLinkable parent) : base(scene, parent) |
@@ -316,6 +330,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
316 | 330 | ||
317 | switch (linkInfo.constraintType) | 331 | switch (linkInfo.constraintType) |
318 | { | 332 | { |
333 | case ConstraintType.FIXED_CONSTRAINT_TYPE: | ||
319 | case ConstraintType.D6_CONSTRAINT_TYPE: | 334 | case ConstraintType.D6_CONSTRAINT_TYPE: |
320 | // Relative position normalized to the root prim | 335 | // Relative position normalized to the root prim |
321 | // Essentually a vector pointing from center of rootPrim to center of li.member | 336 | // Essentually a vector pointing from center of rootPrim to center of li.member |
@@ -466,5 +481,86 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
466 | Rebuilding = false; | 481 | Rebuilding = false; |
467 | } | 482 | } |
468 | } | 483 | } |
484 | |||
485 | #region Extension | ||
486 | public override object Extension(string pFunct, params object[] pParams) | ||
487 | { | ||
488 | object ret = null; | ||
489 | switch (pFunct) | ||
490 | { | ||
491 | // pParams = (int linkNUm, PhysActor linkChild) | ||
492 | case BSScene.PhysFunctChangeLinkFixed: | ||
493 | if (pParams.Length > 1) | ||
494 | { | ||
495 | BSPrimLinkable child = pParams[1] as BSPrimLinkable; | ||
496 | if (child != null) | ||
497 | { | ||
498 | m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() | ||
499 | { | ||
500 | // Pick up all the constraints currently created. | ||
501 | RemoveDependencies(child); | ||
502 | |||
503 | BSLinkInfo linkInfo = null; | ||
504 | if (m_children.TryGetValue(child, out linkInfo)) | ||
505 | { | ||
506 | BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; | ||
507 | if (linkInfoC != null) | ||
508 | { | ||
509 | // Setting to fixed is easy. The reset state is the fixed link configuration. | ||
510 | linkInfoC.ResetLink(); | ||
511 | ret = (object)true; | ||
512 | } | ||
513 | } | ||
514 | // Cause the whole linkset to be rebuilt in post-taint time. | ||
515 | Refresh(child); | ||
516 | }); | ||
517 | } | ||
518 | } | ||
519 | break; | ||
520 | case BSScene.PhysFunctChangeLinkSpring: | ||
521 | if (pParams.Length > 11) | ||
522 | { | ||
523 | BSPrimLinkable child = pParams[1] as BSPrimLinkable; | ||
524 | if (child != null) | ||
525 | { | ||
526 | m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() | ||
527 | { | ||
528 | // Pick up all the constraints currently created. | ||
529 | RemoveDependencies(child); | ||
530 | |||
531 | BSLinkInfo linkInfo = null; | ||
532 | if (m_children.TryGetValue(child, out linkInfo)) | ||
533 | { | ||
534 | BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; | ||
535 | if (linkInfoC != null) | ||
536 | { | ||
537 | // Start with a reset link definition | ||
538 | linkInfoC.ResetLink(); | ||
539 | linkInfoC.constraintType = ConstraintType.D6_SPRING_CONSTRAINT_TYPE; | ||
540 | linkInfoC.frameInAloc = (OMV.Vector3)pParams[2]; | ||
541 | linkInfoC.frameInArot = (OMV.Quaternion)pParams[3]; | ||
542 | linkInfoC.frameInBloc = (OMV.Vector3)pParams[4]; | ||
543 | linkInfoC.frameInBrot = (OMV.Quaternion)pParams[5]; | ||
544 | linkInfoC.linearLimitLow = (OMV.Vector3)pParams[6]; | ||
545 | linkInfoC.linearLimitHigh = (OMV.Vector3)pParams[7]; | ||
546 | linkInfoC.angularLimitLow = (OMV.Vector3)pParams[8]; | ||
547 | linkInfoC.angularLimitHigh = (OMV.Vector3)pParams[9]; | ||
548 | ret = (object)true; | ||
549 | } | ||
550 | } | ||
551 | // Cause the whole linkset to be rebuilt in post-taint time. | ||
552 | Refresh(child); | ||
553 | }); | ||
554 | } | ||
555 | } | ||
556 | break; | ||
557 | default: | ||
558 | ret = base.Extension(pFunct, pParams); | ||
559 | break; | ||
560 | } | ||
561 | return ret; | ||
562 | } | ||
563 | #endregion // Extension | ||
564 | |||
469 | } | 565 | } |
470 | } | 566 | } |