diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | 45 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | 174 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | 24 |
3 files changed, 241 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs index 6c36485..8dfb01c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -596,6 +596,12 @@ public override bool SetBreakingImpulseThreshold(BulletConstraint constrain, flo | |||
596 | return BSAPICPP.SetBreakingImpulseThreshold2(constrainu.ptr, threshold); | 596 | return BSAPICPP.SetBreakingImpulseThreshold2(constrainu.ptr, threshold); |
597 | } | 597 | } |
598 | 598 | ||
599 | public override bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation) | ||
600 | { | ||
601 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
602 | return BSAPICPP.HingeSetLimits2(constrainu.ptr, low, high, softness, bias, relaxation); | ||
603 | } | ||
604 | |||
599 | public override bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse) | 605 | public override bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse) |
600 | { | 606 | { |
601 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | 607 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; |
@@ -620,6 +626,30 @@ public override bool SpringSetDamping(BulletConstraint constrain, int index, flo | |||
620 | return BSAPICPP.ConstraintSpringSetDamping2(constrainu.ptr, index, damping); | 626 | return BSAPICPP.ConstraintSpringSetDamping2(constrainu.ptr, index, damping); |
621 | } | 627 | } |
622 | 628 | ||
629 | public override bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val) | ||
630 | { | ||
631 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
632 | return BSAPICPP.SliderSetLimits2(constrainu.ptr, lowerUpper, linAng, val); | ||
633 | } | ||
634 | |||
635 | public override bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val) | ||
636 | { | ||
637 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
638 | return BSAPICPP.SliderSet2(constrainu.ptr, softRestDamp, dirLimOrtho, linAng, val); | ||
639 | } | ||
640 | |||
641 | public override bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse) | ||
642 | { | ||
643 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
644 | return BSAPICPP.SliderMotorEnable2(constrainu.ptr, linAng, numericTrueFalse); | ||
645 | } | ||
646 | |||
647 | public override bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val) | ||
648 | { | ||
649 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | ||
650 | return BSAPICPP.SliderMotor2(constrainu.ptr, forceVel, linAng, val); | ||
651 | } | ||
652 | |||
623 | public override bool CalculateTransforms(BulletConstraint constrain) | 653 | public override bool CalculateTransforms(BulletConstraint constrain) |
624 | { | 654 | { |
625 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; | 655 | BulletConstraintUnman constrainu = constrain as BulletConstraintUnman; |
@@ -1625,6 +1655,9 @@ public static extern bool TranslationalLimitMotor2(IntPtr constrain, float enabl | |||
1625 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); | 1655 | public static extern bool SetBreakingImpulseThreshold2(IntPtr constrain, float threshold); |
1626 | 1656 | ||
1627 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1657 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1658 | public static extern bool HingeSetLimits2(IntPtr constrain, float low, float high, float softness, float bias, float relaxation); | ||
1659 | |||
1660 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1628 | public static extern bool ConstraintSpringEnable2(IntPtr constrain, int index, float numericTrueFalse); | 1661 | public static extern bool ConstraintSpringEnable2(IntPtr constrain, int index, float numericTrueFalse); |
1629 | 1662 | ||
1630 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1663 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
@@ -1637,6 +1670,18 @@ public static extern bool ConstraintSpringSetStiffness2(IntPtr constrain, int in | |||
1637 | public static extern bool ConstraintSpringSetDamping2(IntPtr constrain, int index, float damping); | 1670 | public static extern bool ConstraintSpringSetDamping2(IntPtr constrain, int index, float damping); |
1638 | 1671 | ||
1639 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1672 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1673 | public static extern bool SliderSetLimits2(IntPtr constrain, int lowerUpper, int linAng, float val); | ||
1674 | |||
1675 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1676 | public static extern bool SliderSet2(IntPtr constrain, int softRestDamp, int dirLimOrtho, int linAng, float val); | ||
1677 | |||
1678 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1679 | public static extern bool SliderMotorEnable2(IntPtr constrain, int linAng, float numericTrueFalse); | ||
1680 | |||
1681 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1682 | public static extern bool SliderMotor2(IntPtr constrain, int forceVel, int linAng, float val); | ||
1683 | |||
1684 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1640 | public static extern bool CalculateTransforms2(IntPtr constrain); | 1685 | public static extern bool CalculateTransforms2(IntPtr constrain); |
1641 | 1686 | ||
1642 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1687 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index 9ad12a9..ff2b497 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | |||
@@ -752,6 +752,15 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
752 | constraint.SetBreakingImpulseThreshold(threshold); | 752 | constraint.SetBreakingImpulseThreshold(threshold); |
753 | return true; | 753 | return true; |
754 | } | 754 | } |
755 | public override bool HingeSetLimits(BulletConstraint pConstraint, float low, float high, float softness, float bias, float relaxation) | ||
756 | { | ||
757 | HingeConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as HingeConstraint; | ||
758 | if (softness == HINGE_NOT_SPECIFIED) | ||
759 | constraint.SetLimit(low, high); | ||
760 | else | ||
761 | constraint.SetLimit(low, high, softness, bias, relaxation); | ||
762 | return true; | ||
763 | } | ||
755 | public override bool SpringEnable(BulletConstraint pConstraint, int index, float numericTrueFalse) | 764 | public override bool SpringEnable(BulletConstraint pConstraint, int index, float numericTrueFalse) |
756 | { | 765 | { |
757 | Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint; | 766 | Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint; |
@@ -762,13 +771,13 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
762 | public override bool SpringSetEquilibriumPoint(BulletConstraint pConstraint, int index, float equilibriumPoint) | 771 | public override bool SpringSetEquilibriumPoint(BulletConstraint pConstraint, int index, float equilibriumPoint) |
763 | { | 772 | { |
764 | Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint; | 773 | Generic6DofSpringConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as Generic6DofSpringConstraint; |
765 | if (index == -1) | 774 | if (index == SPRING_NOT_SPECIFIED) |
766 | { | 775 | { |
767 | constraint.SetEquilibriumPoint(); | 776 | constraint.SetEquilibriumPoint(); |
768 | } | 777 | } |
769 | else | 778 | else |
770 | { | 779 | { |
771 | if (equilibriumPoint == -1) | 780 | if (equilibriumPoint == SPRING_NOT_SPECIFIED) |
772 | constraint.SetEquilibriumPoint(index); | 781 | constraint.SetEquilibriumPoint(index); |
773 | else | 782 | else |
774 | constraint.SetEquilibriumPoint(index, equilibriumPoint); | 783 | constraint.SetEquilibriumPoint(index, equilibriumPoint); |
@@ -790,6 +799,167 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
790 | return true; | 799 | return true; |
791 | } | 800 | } |
792 | 801 | ||
802 | public override bool SliderSetLimits(BulletConstraint pConstraint, int lowerUpper, int linAng, float val) | ||
803 | { | ||
804 | SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint; | ||
805 | switch (lowerUpper) | ||
806 | { | ||
807 | case SLIDER_LOWER_LIMIT: | ||
808 | switch (linAng) | ||
809 | { | ||
810 | case SLIDER_LINEAR: | ||
811 | constraint.SetLowerLinLimit(val); | ||
812 | break; | ||
813 | case SLIDER_ANGULAR: | ||
814 | constraint.SetLowerAngLimit(val); | ||
815 | break; | ||
816 | } | ||
817 | break; | ||
818 | case SLIDER_UPPER_LIMIT: | ||
819 | switch (linAng) | ||
820 | { | ||
821 | case SLIDER_LINEAR: | ||
822 | constraint.SetUpperLinLimit(val); | ||
823 | break; | ||
824 | case SLIDER_ANGULAR: | ||
825 | constraint.SetUpperAngLimit(val); | ||
826 | break; | ||
827 | } | ||
828 | break; | ||
829 | } | ||
830 | return true; | ||
831 | } | ||
832 | public override bool SliderSet(BulletConstraint pConstraint, int softRestDamp, int dirLimOrtho, int linAng, float val) | ||
833 | { | ||
834 | SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint; | ||
835 | switch (softRestDamp) | ||
836 | { | ||
837 | case SLIDER_SET_SOFTNESS: | ||
838 | switch (dirLimOrtho) | ||
839 | { | ||
840 | case SLIDER_SET_DIRECTION: | ||
841 | switch (linAng) | ||
842 | { | ||
843 | case SLIDER_LINEAR: constraint.SetSoftnessDirLin(val); break; | ||
844 | case SLIDER_ANGULAR: constraint.SetSoftnessDirAng(val); break; | ||
845 | } | ||
846 | break; | ||
847 | case SLIDER_SET_LIMIT: | ||
848 | switch (linAng) | ||
849 | { | ||
850 | case SLIDER_LINEAR: constraint.SetSoftnessLimLin(val); break; | ||
851 | case SLIDER_ANGULAR: constraint.SetSoftnessLimAng(val); break; | ||
852 | } | ||
853 | break; | ||
854 | case SLIDER_SET_ORTHO: | ||
855 | switch (linAng) | ||
856 | { | ||
857 | case SLIDER_LINEAR: constraint.SetSoftnessOrthoLin(val); break; | ||
858 | case SLIDER_ANGULAR: constraint.SetSoftnessOrthoAng(val); break; | ||
859 | } | ||
860 | break; | ||
861 | } | ||
862 | break; | ||
863 | case SLIDER_SET_RESTITUTION: | ||
864 | switch (dirLimOrtho) | ||
865 | { | ||
866 | case SLIDER_SET_DIRECTION: | ||
867 | switch (linAng) | ||
868 | { | ||
869 | case SLIDER_LINEAR: constraint.SetRestitutionDirLin(val); break; | ||
870 | case SLIDER_ANGULAR: constraint.SetRestitutionDirAng(val); break; | ||
871 | } | ||
872 | break; | ||
873 | case SLIDER_SET_LIMIT: | ||
874 | switch (linAng) | ||
875 | { | ||
876 | case SLIDER_LINEAR: constraint.SetRestitutionLimLin(val); break; | ||
877 | case SLIDER_ANGULAR: constraint.SetRestitutionLimAng(val); break; | ||
878 | } | ||
879 | break; | ||
880 | case SLIDER_SET_ORTHO: | ||
881 | switch (linAng) | ||
882 | { | ||
883 | case SLIDER_LINEAR: constraint.SetRestitutionOrthoLin(val); break; | ||
884 | case SLIDER_ANGULAR: constraint.SetRestitutionOrthoAng(val); break; | ||
885 | } | ||
886 | break; | ||
887 | } | ||
888 | break; | ||
889 | case SLIDER_SET_DAMPING: | ||
890 | switch (dirLimOrtho) | ||
891 | { | ||
892 | case SLIDER_SET_DIRECTION: | ||
893 | switch (linAng) | ||
894 | { | ||
895 | case SLIDER_LINEAR: constraint.SetDampingDirLin(val); break; | ||
896 | case SLIDER_ANGULAR: constraint.SetDampingDirAng(val); break; | ||
897 | } | ||
898 | break; | ||
899 | case SLIDER_SET_LIMIT: | ||
900 | switch (linAng) | ||
901 | { | ||
902 | case SLIDER_LINEAR: constraint.SetDampingLimLin(val); break; | ||
903 | case SLIDER_ANGULAR: constraint.SetDampingLimAng(val); break; | ||
904 | } | ||
905 | break; | ||
906 | case SLIDER_SET_ORTHO: | ||
907 | switch (linAng) | ||
908 | { | ||
909 | case SLIDER_LINEAR: constraint.SetDampingOrthoLin(val); break; | ||
910 | case SLIDER_ANGULAR: constraint.SetDampingOrthoAng(val); break; | ||
911 | } | ||
912 | break; | ||
913 | } | ||
914 | break; | ||
915 | } | ||
916 | return true; | ||
917 | } | ||
918 | public override bool SliderMotorEnable(BulletConstraint pConstraint, int linAng, float numericTrueFalse) | ||
919 | { | ||
920 | SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint; | ||
921 | switch (linAng) | ||
922 | { | ||
923 | case SLIDER_LINEAR: | ||
924 | constraint.SetPoweredLinMotor(numericTrueFalse == 0.0 ? false : true); | ||
925 | break; | ||
926 | case SLIDER_ANGULAR: | ||
927 | constraint.SetPoweredAngMotor(numericTrueFalse == 0.0 ? false : true); | ||
928 | break; | ||
929 | } | ||
930 | return true; | ||
931 | } | ||
932 | public override bool SliderMotor(BulletConstraint pConstraint, int forceVel, int linAng, float val) | ||
933 | { | ||
934 | SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint; | ||
935 | switch (forceVel) | ||
936 | { | ||
937 | case SLIDER_MOTOR_VELOCITY: | ||
938 | switch (linAng) | ||
939 | { | ||
940 | case SLIDER_LINEAR: | ||
941 | constraint.SetTargetLinMotorVelocity(val); | ||
942 | break; | ||
943 | case SLIDER_ANGULAR: | ||
944 | constraint.SetTargetAngMotorVelocity(val); | ||
945 | break; | ||
946 | } | ||
947 | break; | ||
948 | case SLIDER_MAX_MOTOR_FORCE: | ||
949 | switch (linAng) | ||
950 | { | ||
951 | case SLIDER_LINEAR: | ||
952 | constraint.SetMaxLinMotorForce(val); | ||
953 | break; | ||
954 | case SLIDER_ANGULAR: | ||
955 | constraint.SetMaxAngMotorForce(val); | ||
956 | break; | ||
957 | } | ||
958 | break; | ||
959 | } | ||
960 | return true; | ||
961 | } | ||
962 | |||
793 | //BulletSimAPI.SetAngularDamping(Prim.PhysBody.ptr, angularDamping); | 963 | //BulletSimAPI.SetAngularDamping(Prim.PhysBody.ptr, angularDamping); |
794 | public override void SetAngularDamping(BulletBody pBody, float angularDamping) | 964 | public override void SetAngularDamping(BulletBody pBody, float angularDamping) |
795 | { | 965 | { |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs index 8cca29f..b241059 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |||
@@ -441,14 +441,38 @@ public abstract bool TranslationalLimitMotor(BulletConstraint constrain, float e | |||
441 | 441 | ||
442 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); | 442 | public abstract bool SetBreakingImpulseThreshold(BulletConstraint constrain, float threshold); |
443 | 443 | ||
444 | public const int HINGE_NOT_SPECIFIED = -1; | ||
445 | public abstract bool HingeSetLimits(BulletConstraint constrain, float low, float high, float softness, float bias, float relaxation); | ||
446 | |||
444 | public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse); | 447 | public abstract bool SpringEnable(BulletConstraint constrain, int index, float numericTrueFalse); |
445 | 448 | ||
449 | public const int SPRING_NOT_SPECIFIED = -1; | ||
446 | public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint); | 450 | public abstract bool SpringSetEquilibriumPoint(BulletConstraint constrain, int index, float equilibriumPoint); |
447 | 451 | ||
448 | public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss); | 452 | public abstract bool SpringSetStiffness(BulletConstraint constrain, int index, float stiffnesss); |
449 | 453 | ||
450 | public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping); | 454 | public abstract bool SpringSetDamping(BulletConstraint constrain, int index, float damping); |
451 | 455 | ||
456 | public const int SLIDER_LOWER_LIMIT = 0; | ||
457 | public const int SLIDER_UPPER_LIMIT = 1; | ||
458 | public const int SLIDER_LINEAR = 2; | ||
459 | public const int SLIDER_ANGULAR = 3; | ||
460 | public abstract bool SliderSetLimits(BulletConstraint constrain, int lowerUpper, int linAng, float val); | ||
461 | |||
462 | public const int SLIDER_SET_SOFTNESS = 4; | ||
463 | public const int SLIDER_SET_RESTITUTION = 5; | ||
464 | public const int SLIDER_SET_DAMPING = 6; | ||
465 | public const int SLIDER_SET_DIRECTION = 7; | ||
466 | public const int SLIDER_SET_LIMIT = 8; | ||
467 | public const int SLIDER_SET_ORTHO = 9; | ||
468 | public abstract bool SliderSet(BulletConstraint constrain, int softRestDamp, int dirLimOrtho, int linAng, float val); | ||
469 | |||
470 | public abstract bool SliderMotorEnable(BulletConstraint constrain, int linAng, float numericTrueFalse); | ||
471 | |||
472 | public const int SLIDER_MOTOR_VELOCITY = 10; | ||
473 | public const int SLIDER_MAX_MOTOR_FORCE = 11; | ||
474 | public abstract bool SliderMotor(BulletConstraint constrain, int forceVel, int linAng, float val); | ||
475 | |||
452 | public abstract bool CalculateTransforms(BulletConstraint constrain); | 476 | public abstract bool CalculateTransforms(BulletConstraint constrain); |
453 | 477 | ||
454 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); | 478 | public abstract bool SetConstraintParam(BulletConstraint constrain, ConstraintParams paramIndex, float value, ConstraintParamAxis axis); |