diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | 85 |
1 files changed, 31 insertions, 54 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index 17fec9d..c09dd42 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -28,6 +28,8 @@ using System; | |||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Text; | 29 | using System.Text; |
30 | 30 | ||
31 | using OpenSim.Region.OptionalModules.Scripting; | ||
32 | |||
31 | using OMV = OpenMetaverse; | 33 | using OMV = OpenMetaverse; |
32 | 34 | ||
33 | namespace OpenSim.Region.Physics.BulletSPlugin | 35 | namespace OpenSim.Region.Physics.BulletSPlugin |
@@ -489,71 +491,46 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
489 | switch (pFunct) | 491 | switch (pFunct) |
490 | { | 492 | { |
491 | // pParams = (int linkNUm, PhysActor linkChild) | 493 | // pParams = (int linkNUm, PhysActor linkChild) |
492 | case BSScene.PhysFunctChangeLinkFixed: | 494 | case ExtendedPhysics.PhysFunctChangeLinkType: |
493 | if (pParams.Length > 1) | 495 | if (pParams.Length > 1) |
494 | { | 496 | { |
495 | BSPrimLinkable child = pParams[1] as BSPrimLinkable; | 497 | int requestedType = (int)pParams[1]; |
496 | if (child != null) | 498 | if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE |
499 | || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE | ||
500 | || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE | ||
501 | || requestedType == (int)ConstraintType.HINGE_CONSTRAINT_TYPE | ||
502 | || requestedType == (int)ConstraintType.CONETWIST_CONSTRAINT_TYPE | ||
503 | || requestedType == (int)ConstraintType.SLIDER_CONSTRAINT_TYPE) | ||
497 | { | 504 | { |
498 | m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() | 505 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; |
506 | if (child != null) | ||
499 | { | 507 | { |
500 | // Pick up all the constraints currently created. | 508 | m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() |
501 | RemoveDependencies(child); | ||
502 | |||
503 | BSLinkInfo linkInfo = null; | ||
504 | if (m_children.TryGetValue(child, out linkInfo)) | ||
505 | { | 509 | { |
506 | BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; | 510 | // Pick up all the constraints currently created. |
507 | if (linkInfoC != null) | 511 | RemoveDependencies(child); |
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 | 512 | ||
531 | BSLinkInfo linkInfo = null; | 513 | BSLinkInfo linkInfo = null; |
532 | if (m_children.TryGetValue(child, out linkInfo)) | 514 | if (m_children.TryGetValue(child, out linkInfo)) |
533 | { | ||
534 | BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; | ||
535 | if (linkInfoC != null) | ||
536 | { | 515 | { |
537 | // Start with a reset link definition | 516 | BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; |
538 | linkInfoC.ResetLink(); | 517 | if (linkInfoC != null) |
539 | linkInfoC.constraintType = ConstraintType.D6_SPRING_CONSTRAINT_TYPE; | 518 | { |
540 | linkInfoC.frameInAloc = (OMV.Vector3)pParams[2]; | 519 | // Setting to fixed is easy. The reset state is the fixed link configuration. |
541 | linkInfoC.frameInArot = (OMV.Quaternion)pParams[3]; | 520 | linkInfoC.ResetLink(); |
542 | linkInfoC.frameInBloc = (OMV.Vector3)pParams[4]; | 521 | linkInfoC.constraintType = (ConstraintType)requestedType; |
543 | linkInfoC.frameInBrot = (OMV.Quaternion)pParams[5]; | 522 | ret = (object)true; |
544 | linkInfoC.linearLimitLow = (OMV.Vector3)pParams[6]; | 523 | } |
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 | } | 524 | } |
550 | } | 525 | // Cause the whole linkset to be rebuilt in post-taint time. |
551 | // Cause the whole linkset to be rebuilt in post-taint time. | 526 | Refresh(child); |
552 | Refresh(child); | 527 | }); |
553 | }); | 528 | } |
554 | } | 529 | } |
555 | } | 530 | } |
556 | break; | 531 | break; |
532 | case ExtendedPhysics.PhysFunctChangeLinkParams: | ||
533 | break; | ||
557 | default: | 534 | default: |
558 | ret = base.Extension(pFunct, pParams); | 535 | ret = base.Extension(pFunct, pParams); |
559 | break; | 536 | break; |