diff options
author | Robert Adams | 2013-08-20 08:14:08 -0700 |
---|---|---|
committer | Robert Adams | 2013-09-11 09:12:02 -0700 |
commit | 4781297b4ee5908b76039ce3b38291eb2e89e157 (patch) | |
tree | 02eda7c6afb4137afbffacb82dc1507a778ffe0f /OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |
parent | BulletSim: adjust avatar capsule height calculation to be closer to defined S... (diff) | |
download | opensim-SC-4781297b4ee5908b76039ce3b38291eb2e89e157.zip opensim-SC-4781297b4ee5908b76039ce3b38291eb2e89e157.tar.gz opensim-SC-4781297b4ee5908b76039ce3b38291eb2e89e157.tar.bz2 opensim-SC-4781297b4ee5908b76039ce3b38291eb2e89e157.tar.xz |
BulletSim: Extension parameters passed through the classes made to pass just and array of objects rather than a mixture of parameters and array. Makes understanding and parsing what is being passed much easier.
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | 93 |
1 files changed, 69 insertions, 24 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index 92df84e..87716b4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -343,7 +343,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
343 | // real world coordinate of midpoint between the two objects | 343 | // real world coordinate of midpoint between the two objects |
344 | OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2); | 344 | OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2); |
345 | 345 | ||
346 | DetailLog("{0},BSLinksetConstraint.BuildConstraint,6Dof,rBody={1},cBody={2},rLoc={3},cLoc={4},midLoc={7}", | 346 | DetailLog("{0},BSLinksetConstraint.BuildConstraint,6Dof,rBody={1},cBody={2},rLoc={3},cLoc={4},midLoc={5}", |
347 | rootPrim.LocalID, rootPrim.PhysBody, linkInfo.member.PhysBody, | 347 | rootPrim.LocalID, rootPrim.PhysBody, linkInfo.member.PhysBody, |
348 | rootPrim.Position, linkInfo.member.Position, midPoint); | 348 | rootPrim.Position, linkInfo.member.Position, midPoint); |
349 | 349 | ||
@@ -492,11 +492,12 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
492 | object ret = null; | 492 | object ret = null; |
493 | switch (pFunct) | 493 | switch (pFunct) |
494 | { | 494 | { |
495 | // pParams = (int linkNUm, PhysActor linkChild) | 495 | // pParams = [ BSPhysObject child, integer linkType ] |
496 | case ExtendedPhysics.PhysFunctChangeLinkType: | 496 | case ExtendedPhysics.PhysFunctChangeLinkType: |
497 | if (pParams.Length > 1) | 497 | if (pParams.Length > 1) |
498 | { | 498 | { |
499 | int requestedType = (int)pParams[1]; | 499 | int requestedType = (int)pParams[1]; |
500 | DetailLog("{0},BSLinksetConstraint.SetLinkType,requestedType={1}", LinksetRoot.LocalID, requestedType); | ||
500 | if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE | 501 | if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE |
501 | || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE | 502 | || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE |
502 | || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE | 503 | || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE |
@@ -507,7 +508,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
507 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; | 508 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; |
508 | if (child != null) | 509 | if (child != null) |
509 | { | 510 | { |
510 | m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() | 511 | m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkType", delegate() |
511 | { | 512 | { |
512 | // Pick up all the constraints currently created. | 513 | // Pick up all the constraints currently created. |
513 | RemoveDependencies(child); | 514 | RemoveDependencies(child); |
@@ -522,15 +523,35 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
522 | linkInfoC.ResetLink(); | 523 | linkInfoC.ResetLink(); |
523 | linkInfoC.constraintType = (ConstraintType)requestedType; | 524 | linkInfoC.constraintType = (ConstraintType)requestedType; |
524 | ret = (object)true; | 525 | ret = (object)true; |
526 | DetailLog("{0},BSLinksetConstraint.SetLinkType,link={1},type={2}", | ||
527 | linkInfo.member.LocalID, linkInfo.member.LocalID, linkInfoC.constraintType); | ||
528 | } | ||
529 | else | ||
530 | { | ||
531 | DetailLog("{0},BSLinksetConstraint.SetLinkType,linkInfoNotConstraint,childID={1}", LinksetRoot.LocalID, child.LocalID); | ||
525 | } | 532 | } |
526 | } | 533 | } |
534 | else | ||
535 | { | ||
536 | DetailLog("{0},BSLinksetConstraint.SetLinkType,noLinkInfoForChild,childID={1}", LinksetRoot.LocalID, child.LocalID); | ||
537 | } | ||
527 | // Cause the whole linkset to be rebuilt in post-taint time. | 538 | // Cause the whole linkset to be rebuilt in post-taint time. |
528 | Refresh(child); | 539 | Refresh(child); |
529 | }); | 540 | }); |
530 | } | 541 | } |
542 | else | ||
543 | { | ||
544 | DetailLog("{0},BSLinksetConstraint.SetLinkType,childNotBSPrimLinkable", LinksetRoot.LocalID); | ||
545 | } | ||
546 | } | ||
547 | else | ||
548 | { | ||
549 | DetailLog("{0},BSLinksetConstraint.SetLinkType,illegalRequestedType,reqested={1},spring={2}", | ||
550 | LinksetRoot.LocalID, requestedType, ((int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE)); | ||
531 | } | 551 | } |
532 | } | 552 | } |
533 | break; | 553 | break; |
554 | // pParams = [] | ||
534 | case ExtendedPhysics.PhysFunctGetLinkType: | 555 | case ExtendedPhysics.PhysFunctGetLinkType: |
535 | if (pParams.Length > 0) | 556 | if (pParams.Length > 0) |
536 | { | 557 | { |
@@ -544,11 +565,15 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
544 | if (linkInfoC != null) | 565 | if (linkInfoC != null) |
545 | { | 566 | { |
546 | ret = (object)(int)linkInfoC.constraintType; | 567 | ret = (object)(int)linkInfoC.constraintType; |
568 | DetailLog("{0},BSLinksetConstraint.GetLinkType,link={1},type={2}", | ||
569 | linkInfo.member.LocalID, linkInfo.member.LocalID, linkInfoC.constraintType); | ||
570 | |||
547 | } | 571 | } |
548 | } | 572 | } |
549 | } | 573 | } |
550 | } | 574 | } |
551 | break; | 575 | break; |
576 | // pParams = [ BSPhysObject child, int op, object opParams, int op, object opParams, ... ] | ||
552 | case ExtendedPhysics.PhysFunctChangeLinkParams: | 577 | case ExtendedPhysics.PhysFunctChangeLinkParams: |
553 | // There should be two parameters: the childActor and a list of parameters to set | 578 | // There should be two parameters: the childActor and a list of parameters to set |
554 | try | 579 | try |
@@ -556,7 +581,6 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
556 | if (pParams.Length > 1) | 581 | if (pParams.Length > 1) |
557 | { | 582 | { |
558 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; | 583 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; |
559 | object[] setOps = (object[])pParams[1]; | ||
560 | BSLinkInfo baseLinkInfo = null; | 584 | BSLinkInfo baseLinkInfo = null; |
561 | if (TryGetLinkInfo(child, out baseLinkInfo)) | 585 | if (TryGetLinkInfo(child, out baseLinkInfo)) |
562 | { | 586 | { |
@@ -568,85 +592,106 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
568 | OMV.Vector3 valueVector; | 592 | OMV.Vector3 valueVector; |
569 | OMV.Quaternion valueQuaternion; | 593 | OMV.Quaternion valueQuaternion; |
570 | 594 | ||
571 | int opIndex = 0; | 595 | int opIndex = 1; |
572 | while (opIndex < setOps.Length) | 596 | while (opIndex < pParams.Length) |
573 | { | 597 | { |
574 | int thisOp = (int)setOps[opIndex]; | 598 | int thisOp = (int)pParams[opIndex]; |
599 | DetailLog("{0},BSLinksetConstraint.ChangeLinkParams2,op={1},val={2}", | ||
600 | linkInfo.member.LocalID, thisOp, pParams[opIndex+1]); | ||
575 | switch (thisOp) | 601 | switch (thisOp) |
576 | { | 602 | { |
577 | case ExtendedPhysics.PHYS_PARAM_FRAMEINA_LOC: | 603 | case ExtendedPhysics.PHYS_PARAM_FRAMEINA_LOC: |
578 | valueVector = (OMV.Vector3)setOps[opIndex + 1]; | 604 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; |
579 | linkInfo.frameInAloc = valueVector; | 605 | linkInfo.frameInAloc = valueVector; |
606 | opIndex += 2; | ||
580 | break; | 607 | break; |
581 | case ExtendedPhysics.PHYS_PARAM_FRAMEINA_ROT: | 608 | case ExtendedPhysics.PHYS_PARAM_FRAMEINA_ROT: |
582 | valueQuaternion = (OMV.Quaternion)setOps[opIndex + 1]; | 609 | valueQuaternion = (OMV.Quaternion)pParams[opIndex + 1]; |
583 | linkInfo.frameInArot = valueQuaternion; | 610 | linkInfo.frameInArot = valueQuaternion; |
611 | opIndex += 2; | ||
584 | break; | 612 | break; |
585 | case ExtendedPhysics.PHYS_PARAM_FRAMEINB_LOC: | 613 | case ExtendedPhysics.PHYS_PARAM_FRAMEINB_LOC: |
586 | valueVector = (OMV.Vector3)setOps[opIndex + 1]; | 614 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; |
587 | linkInfo.frameInBloc = valueVector; | 615 | linkInfo.frameInBloc = valueVector; |
616 | opIndex += 2; | ||
588 | break; | 617 | break; |
589 | case ExtendedPhysics.PHYS_PARAM_FRAMEINB_ROT: | 618 | case ExtendedPhysics.PHYS_PARAM_FRAMEINB_ROT: |
590 | valueQuaternion = (OMV.Quaternion)setOps[opIndex + 1]; | 619 | valueQuaternion = (OMV.Quaternion)pParams[opIndex + 1]; |
591 | linkInfo.frameInBrot = valueQuaternion; | 620 | linkInfo.frameInBrot = valueQuaternion; |
621 | opIndex += 2; | ||
592 | break; | 622 | break; |
593 | case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_LOW: | 623 | case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_LOW: |
594 | valueVector = (OMV.Vector3)setOps[opIndex + 1]; | 624 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; |
595 | linkInfo.linearLimitLow = valueVector; | 625 | linkInfo.linearLimitLow = valueVector; |
626 | opIndex += 2; | ||
596 | break; | 627 | break; |
597 | case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_HIGH: | 628 | case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_HIGH: |
598 | valueVector = (OMV.Vector3)setOps[opIndex + 1]; | 629 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; |
599 | linkInfo.linearLimitHigh = valueVector; | 630 | linkInfo.linearLimitHigh = valueVector; |
631 | opIndex += 2; | ||
600 | break; | 632 | break; |
601 | case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_LOW: | 633 | case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_LOW: |
602 | valueVector = (OMV.Vector3)setOps[opIndex + 1]; | 634 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; |
603 | linkInfo.angularLimitLow = valueVector; | 635 | linkInfo.angularLimitLow = valueVector; |
636 | opIndex += 2; | ||
604 | break; | 637 | break; |
605 | case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_HIGH: | 638 | case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_HIGH: |
606 | valueVector = (OMV.Vector3)setOps[opIndex + 1]; | 639 | valueVector = (OMV.Vector3)pParams[opIndex + 1]; |
607 | linkInfo.angularLimitHigh = valueVector; | 640 | linkInfo.angularLimitHigh = valueVector; |
641 | opIndex += 2; | ||
608 | break; | 642 | break; |
609 | case ExtendedPhysics.PHYS_PARAM_USE_FRAME_OFFSET: | 643 | case ExtendedPhysics.PHYS_PARAM_USE_FRAME_OFFSET: |
610 | valueBool = (bool)setOps[opIndex + 1]; | 644 | valueBool = (bool)pParams[opIndex + 1]; |
611 | linkInfo.useFrameOffset = valueBool; | 645 | linkInfo.useFrameOffset = valueBool; |
646 | opIndex += 2; | ||
612 | break; | 647 | break; |
613 | case ExtendedPhysics.PHYS_PARAM_ENABLE_TRANSMOTOR: | 648 | case ExtendedPhysics.PHYS_PARAM_ENABLE_TRANSMOTOR: |
614 | valueBool = (bool)setOps[opIndex + 1]; | 649 | valueBool = (bool)pParams[opIndex + 1]; |
615 | linkInfo.enableTransMotor = valueBool; | 650 | linkInfo.enableTransMotor = valueBool; |
651 | opIndex += 2; | ||
616 | break; | 652 | break; |
617 | case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXVEL: | 653 | case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXVEL: |
618 | valueFloat = (float)setOps[opIndex + 1]; | 654 | valueFloat = (float)pParams[opIndex + 1]; |
619 | linkInfo.transMotorMaxVel = valueFloat; | 655 | linkInfo.transMotorMaxVel = valueFloat; |
656 | opIndex += 2; | ||
620 | break; | 657 | break; |
621 | case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXFORCE: | 658 | case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXFORCE: |
622 | valueFloat = (float)setOps[opIndex + 1]; | 659 | valueFloat = (float)pParams[opIndex + 1]; |
623 | linkInfo.transMotorMaxForce = valueFloat; | 660 | linkInfo.transMotorMaxForce = valueFloat; |
661 | opIndex += 2; | ||
624 | break; | 662 | break; |
625 | case ExtendedPhysics.PHYS_PARAM_CFM: | 663 | case ExtendedPhysics.PHYS_PARAM_CFM: |
626 | valueFloat = (float)setOps[opIndex + 1]; | 664 | valueFloat = (float)pParams[opIndex + 1]; |
627 | linkInfo.cfm = valueFloat; | 665 | linkInfo.cfm = valueFloat; |
666 | opIndex += 2; | ||
628 | break; | 667 | break; |
629 | case ExtendedPhysics.PHYS_PARAM_ERP: | 668 | case ExtendedPhysics.PHYS_PARAM_ERP: |
630 | valueFloat = (float)setOps[opIndex + 1]; | 669 | valueFloat = (float)pParams[opIndex + 1]; |
631 | linkInfo.erp = valueFloat; | 670 | linkInfo.erp = valueFloat; |
671 | opIndex += 2; | ||
632 | break; | 672 | break; |
633 | case ExtendedPhysics.PHYS_PARAM_SOLVER_ITERATIONS: | 673 | case ExtendedPhysics.PHYS_PARAM_SOLVER_ITERATIONS: |
634 | valueFloat = (float)setOps[opIndex + 1]; | 674 | valueFloat = (float)pParams[opIndex + 1]; |
635 | linkInfo.solverIterations = valueFloat; | 675 | linkInfo.solverIterations = valueFloat; |
676 | opIndex += 2; | ||
636 | break; | 677 | break; |
637 | case ExtendedPhysics.PHYS_PARAM_SPRING_DAMPING: | 678 | case ExtendedPhysics.PHYS_PARAM_SPRING_DAMPING: |
638 | valueFloat = (float)setOps[opIndex + 1]; | 679 | valueFloat = (float)pParams[opIndex + 1]; |
639 | linkInfo.springDamping = valueFloat; | 680 | linkInfo.springDamping = valueFloat; |
681 | opIndex += 2; | ||
640 | break; | 682 | break; |
641 | case ExtendedPhysics.PHYS_PARAM_SPRING_STIFFNESS: | 683 | case ExtendedPhysics.PHYS_PARAM_SPRING_STIFFNESS: |
642 | valueFloat = (float)setOps[opIndex + 1]; | 684 | valueFloat = (float)pParams[opIndex + 1]; |
643 | linkInfo.springStiffness = valueFloat; | 685 | linkInfo.springStiffness = valueFloat; |
686 | opIndex += 2; | ||
644 | break; | 687 | break; |
645 | default: | 688 | default: |
646 | break; | 689 | break; |
647 | } | 690 | } |
648 | } | 691 | } |
649 | } | 692 | } |
693 | // Something changed so a rebuild is in order | ||
694 | Refresh(child); | ||
650 | } | 695 | } |
651 | } | 696 | } |
652 | } | 697 | } |