diff options
author | UbitUmarov | 2014-07-21 23:54:53 +0100 |
---|---|---|
committer | UbitUmarov | 2014-07-21 23:54:53 +0100 |
commit | 0239c7ba1c85fe67ec5f9657c4193228677349ff (patch) | |
tree | c0e11c8eccd9c0025656b89ad641e23d045ba9b7 | |
parent | change presence movetotarget avoiding trying to go undergroud or fly when (diff) | |
download | opensim-SC_OLD-0239c7ba1c85fe67ec5f9657c4193228677349ff.zip opensim-SC_OLD-0239c7ba1c85fe67ec5f9657c4193228677349ff.tar.gz opensim-SC_OLD-0239c7ba1c85fe67ec5f9657c4193228677349ff.tar.bz2 opensim-SC_OLD-0239c7ba1c85fe67ec5f9657c4193228677349ff.tar.xz |
avatar collisions fix
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 309cebd..9bf2abe 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -833,13 +833,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
833 | switch (p2.PhysicsActorType) | 833 | switch (p2.PhysicsActorType) |
834 | { | 834 | { |
835 | case (int)ActorTypes.Agent: | 835 | case (int)ActorTypes.Agent: |
836 | p1.CollidingObj = true; | ||
837 | p2.CollidingObj = true; | ||
838 | break; | ||
839 | |||
840 | case (int)ActorTypes.Prim: | 836 | case (int)ActorTypes.Prim: |
841 | if (p2.Velocity.LengthSquared() > 0.0f) | ||
842 | p2.CollidingObj = true; | ||
843 | break; | 837 | break; |
844 | 838 | ||
845 | default: | 839 | default: |
@@ -850,55 +844,53 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
850 | } | 844 | } |
851 | 845 | ||
852 | case (int)ActorTypes.Prim: | 846 | case (int)ActorTypes.Prim: |
853 | switch (p2.PhysicsActorType) | ||
854 | { | 847 | { |
855 | case (int)ActorTypes.Agent: | 848 | switch (p2.PhysicsActorType) |
856 | 849 | { | |
857 | dop2ava = true; | 850 | case (int)ActorTypes.Agent: |
858 | 851 | dop2ava = true; | |
859 | if (p1.Velocity.LengthSquared() > 0.0f) | 852 | break; |
860 | p1.CollidingObj = true; | ||
861 | break; | ||
862 | 853 | ||
863 | case (int)ActorTypes.Prim: | 854 | case (int)ActorTypes.Prim: |
864 | Vector3 relV = p1.Velocity - p2.Velocity; | 855 | Vector3 relV = p1.Velocity - p2.Velocity; |
865 | float relVlenSQ = relV.LengthSquared(); | 856 | float relVlenSQ = relV.LengthSquared(); |
866 | if (relVlenSQ > 0.0001f) | 857 | if (relVlenSQ > 0.0001f) |
867 | { | 858 | { |
868 | p1.CollidingObj = true; | 859 | p1.CollidingObj = true; |
869 | p2.CollidingObj = true; | 860 | p2.CollidingObj = true; |
870 | } | 861 | } |
871 | p1.getContactData(ref contactdata1); | 862 | p1.getContactData(ref contactdata1); |
872 | p2.getContactData(ref contactdata2); | 863 | p2.getContactData(ref contactdata2); |
873 | bounce = contactdata1.bounce * contactdata2.bounce; | 864 | bounce = contactdata1.bounce * contactdata2.bounce; |
874 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); | 865 | mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu); |
875 | 866 | ||
876 | if (relVlenSQ > 0.01f) | 867 | if (relVlenSQ > 0.01f) |
877 | mu *= frictionMovementMult; | 868 | mu *= frictionMovementMult; |
878 | 869 | ||
879 | break; | 870 | break; |
880 | |||
881 | case (int)ActorTypes.Ground: | ||
882 | p1.getContactData(ref contactdata1); | ||
883 | bounce = contactdata1.bounce * TerrainBounce; | ||
884 | mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); | ||
885 | 871 | ||
886 | if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) | 872 | case (int)ActorTypes.Ground: |
887 | mu *= frictionMovementMult; | 873 | p1.getContactData(ref contactdata1); |
888 | p1.CollidingGround = true; | 874 | bounce = contactdata1.bounce * TerrainBounce; |
889 | /* | 875 | mu = (float)Math.Sqrt(contactdata1.mu * TerrainFriction); |
890 | if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) | 876 | |
891 | { | 877 | if (Math.Abs(p1.Velocity.X) > 0.1f || Math.Abs(p1.Velocity.Y) > 0.1f) |
892 | if (curContact.side1 > 0) | 878 | mu *= frictionMovementMult; |
893 | IgnoreNegSides = true; | 879 | p1.CollidingGround = true; |
894 | } | 880 | /* |
895 | */ | 881 | if (d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) |
896 | break; | 882 | { |
883 | if (curContact.side1 > 0) | ||
884 | IgnoreNegSides = true; | ||
885 | } | ||
886 | */ | ||
887 | break; | ||
897 | 888 | ||
898 | case (int)ActorTypes.Water: | 889 | case (int)ActorTypes.Water: |
899 | default: | 890 | default: |
900 | ignore = true; | 891 | ignore = true; |
901 | break; | 892 | break; |
893 | } | ||
902 | } | 894 | } |
903 | break; | 895 | break; |
904 | 896 | ||
@@ -950,14 +942,25 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
950 | bool noskip = true; | 942 | bool noskip = true; |
951 | if (dop1ava) | 943 | if (dop1ava) |
952 | { | 944 | { |
953 | if (!(((OdeCharacter)p1).Collide(g1,g2, false, ref curContact, ref FeetCollision))) | 945 | if (!(((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref FeetCollision))) |
954 | |||
955 | noskip = false; | 946 | noskip = false; |
947 | else | ||
948 | { | ||
949 | if(p2.PhysicsActorType == (int)ActorTypes.Agent) | ||
950 | { | ||
951 | p1.CollidingObj = true; | ||
952 | p2.CollidingObj = true; | ||
953 | } | ||
954 | else if (p2.Velocity.LengthSquared() > 0.0f) | ||
955 | p2.CollidingObj = true; | ||
956 | } | ||
956 | } | 957 | } |
957 | else if (dop2ava) | 958 | else if (dop2ava) |
958 | { | 959 | { |
959 | if (!(((OdeCharacter)p2).Collide(g2,g1, true, ref curContact, ref FeetCollision))) | 960 | if (!(((OdeCharacter)p2).Collide(g2,g1, true, ref curContact, ref FeetCollision))) |
960 | noskip = false; | 961 | noskip = false; |
962 | else if (p1.Velocity.LengthSquared() > 0.0f) | ||
963 | p1.CollidingObj = true; | ||
961 | } | 964 | } |
962 | 965 | ||
963 | if (noskip) | 966 | if (noskip) |