aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs112
1 files changed, 58 insertions, 54 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 8abf6cf..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
863 case (int)ActorTypes.Prim:
864 Vector3 relV = p1.Velocity - p2.Velocity;
865 float relVlenSQ = relV.LengthSquared();
866 if (relVlenSQ > 0.0001f)
867 {
868 p1.CollidingObj = true;
869 p2.CollidingObj = true;
870 }
871 p1.getContactData(ref contactdata1);
872 p2.getContactData(ref contactdata2);
873 bounce = contactdata1.bounce * contactdata2.bounce;
874 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
875 853
876 if (relVlenSQ > 0.01f) 854 case (int)ActorTypes.Prim:
877 mu *= frictionMovementMult; 855 Vector3 relV = p1.Velocity - p2.Velocity;
856 float relVlenSQ = relV.LengthSquared();
857 if (relVlenSQ > 0.0001f)
858 {
859 p1.CollidingObj = true;
860 p2.CollidingObj = true;
861 }
862 p1.getContactData(ref contactdata1);
863 p2.getContactData(ref contactdata2);
864 bounce = contactdata1.bounce * contactdata2.bounce;
865 mu = (float)Math.Sqrt(contactdata1.mu * contactdata2.mu);
878 866
879 break; 867 if (relVlenSQ > 0.01f)
868 mu *= frictionMovementMult;
880 869
881 case (int)ActorTypes.Ground: 870 break;
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, 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, 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)
@@ -1095,10 +1098,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1095 // do colisions with static space 1098 // do colisions with static space
1096 d.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback); 1099 d.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback);
1097 1100
1098 // chars with chars
1099 d.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback);
1100 // no coll with gnd 1101 // no coll with gnd
1101 } 1102 }
1103 // chars with chars
1104 d.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback);
1105
1102 } 1106 }
1103 catch (AccessViolationException) 1107 catch (AccessViolationException)
1104 { 1108 {