diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index a397467..7eca7ed 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -659,11 +659,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
659 | public float CAPSULE_LENGTH = 0.79f; | 659 | public float CAPSULE_LENGTH = 0.79f; |
660 | private bool flying = false; | 660 | private bool flying = false; |
661 | private bool m_iscolliding = false; | 661 | private bool m_iscolliding = false; |
662 | private bool m_iscollidingGround = false; | ||
662 | private bool m_wascolliding = false; | 663 | private bool m_wascolliding = false; |
664 | private bool m_wascollidingGround = false; | ||
663 | private bool m_alwaysRun = false; | 665 | private bool m_alwaysRun = false; |
666 | private bool m_hackSentFall = false; | ||
667 | private bool m_hackSentFly = false; | ||
664 | private string m_name = ""; | 668 | private string m_name = ""; |
665 | 669 | ||
666 | private bool[] m_colliderarr = new bool[11]; | 670 | private bool[] m_colliderarr = new bool[11]; |
671 | private bool[] m_colliderGroundarr = new bool[11]; | ||
672 | |||
667 | 673 | ||
668 | private bool jumping = false; | 674 | private bool jumping = false; |
669 | //private float gravityAccel; | 675 | //private float gravityAccel; |
@@ -775,8 +781,50 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
775 | } | 781 | } |
776 | public override bool CollidingGround | 782 | public override bool CollidingGround |
777 | { | 783 | { |
778 | get { return false; } | 784 | get { return m_iscollidingGround; } |
779 | set { return; } | 785 | set |
786 | { | ||
787 | int i; | ||
788 | int truecount = 0; | ||
789 | int falsecount = 0; | ||
790 | |||
791 | if (m_colliderGroundarr.Length >= 10) | ||
792 | { | ||
793 | for (i = 0; i < 10; i++) | ||
794 | { | ||
795 | m_colliderGroundarr[i] = m_colliderGroundarr[i + 1]; | ||
796 | } | ||
797 | } | ||
798 | m_colliderGroundarr[10] = value; | ||
799 | |||
800 | for (i = 0; i < 11; i++) | ||
801 | { | ||
802 | if (m_colliderGroundarr[i]) | ||
803 | { | ||
804 | truecount++; | ||
805 | } | ||
806 | else | ||
807 | { | ||
808 | falsecount++; | ||
809 | } | ||
810 | } | ||
811 | |||
812 | // Equal truecounts and false counts means we're colliding with something. | ||
813 | |||
814 | if (falsecount > 1.2 * truecount) | ||
815 | { | ||
816 | m_iscollidingGround = false; | ||
817 | } | ||
818 | else | ||
819 | { | ||
820 | m_iscollidingGround = true; | ||
821 | } | ||
822 | if (m_wascollidingGround != m_iscollidingGround) | ||
823 | { | ||
824 | //base.SendCollisionUpdate(new CollisionEventUpdate()); | ||
825 | } | ||
826 | m_wascollidingGround = m_iscollidingGround; | ||
827 | } | ||
780 | } | 828 | } |
781 | public override bool CollidingObj | 829 | public override bool CollidingObj |
782 | { | 830 | { |
@@ -1017,7 +1065,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1017 | vec = d.BodyGetLinearVel(Body); | 1065 | vec = d.BodyGetLinearVel(Body); |
1018 | _velocity.X = (vec.X); | 1066 | _velocity.X = (vec.X); |
1019 | _velocity.Y = (vec.Y); | 1067 | _velocity.Y = (vec.Y); |
1068 | |||
1020 | _velocity.Z = (vec.Z); | 1069 | _velocity.Z = (vec.Z); |
1070 | if (_velocity.Z < -6 && !m_hackSentFall) | ||
1071 | { | ||
1072 | m_hackSentFall = true; | ||
1073 | base.SendCollisionUpdate(new CollisionEventUpdate()); | ||
1074 | } | ||
1075 | else if (flying && !m_hackSentFly) | ||
1076 | { | ||
1077 | //m_hackSentFly = true; | ||
1078 | //base.SendCollisionUpdate(new CollisionEventUpdate()); | ||
1079 | } | ||
1080 | else | ||
1081 | { | ||
1082 | m_hackSentFly = false; | ||
1083 | m_hackSentFall = false; | ||
1084 | } | ||
1021 | } | 1085 | } |
1022 | } | 1086 | } |
1023 | 1087 | ||