diff options
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 510cbe9..754bc86 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -995,63 +995,67 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
995 | 995 | ||
996 | 996 | ||
997 | d.ContactGeom maxContact = curContact; | 997 | d.ContactGeom maxContact = curContact; |
998 | // if (IgnoreNegSides && curContact.side1 < 0) | 998 | // if (IgnoreNegSides && curContact.side1 < 0) |
999 | // maxContact.depth = float.MinValue; | 999 | // maxContact.depth = float.MinValue; |
1000 | 1000 | ||
1001 | d.ContactGeom minContact = curContact; | 1001 | d.ContactGeom minContact = curContact; |
1002 | // if (IgnoreNegSides && curContact.side1 < 0) | 1002 | // if (IgnoreNegSides && curContact.side1 < 0) |
1003 | // minContact.depth = float.MaxValue; | 1003 | // minContact.depth = float.MaxValue; |
1004 | 1004 | ||
1005 | IntPtr Joint; | 1005 | IntPtr Joint; |
1006 | bool FeetCollision = false; | 1006 | bool FeetCollision = false; |
1007 | int ncontacts = 0; | 1007 | int ncontacts = 0; |
1008 | 1008 | ||
1009 | 1009 | ||
1010 | int i = 0; | 1010 | int i = 0; |
1011 | 1011 | ||
1012 | while (true) | 1012 | while (true) |
1013 | { | 1013 | { |
1014 | if (m_global_contactcount >= maxContactsbeforedeath) | ||
1015 | break; | ||
1016 | 1014 | ||
1017 | // if (!(IgnoreNegSides && curContact.side1 < 0)) | 1015 | // if (!(IgnoreNegSides && curContact.side1 < 0)) |
1016 | { | ||
1017 | bool noskip = true; | ||
1018 | if (dop1ava) | ||
1018 | { | 1019 | { |
1019 | bool noskip = true; | 1020 | if (!(((OdeCharacter)p1).Collide(g1, false, ref curContact, ref FeetCollision))) |
1020 | if (dop1ava) | ||
1021 | { | ||
1022 | if (!(((OdeCharacter)p1).Collide(g1,false, ref curContact, ref FeetCollision))) | ||
1023 | 1021 | ||
1024 | noskip = false; | 1022 | noskip = false; |
1025 | } | 1023 | } |
1026 | else if (dop2ava) | 1024 | else if (dop2ava) |
1027 | { | 1025 | { |
1028 | if (!(((OdeCharacter)p2).Collide(g2,true, ref curContact, ref FeetCollision))) | 1026 | if (!(((OdeCharacter)p2).Collide(g2, true, ref curContact, ref FeetCollision))) |
1029 | noskip = false; | 1027 | noskip = false; |
1030 | } | 1028 | } |
1031 | 1029 | ||
1032 | if (noskip) | 1030 | if (noskip) |
1033 | { | 1031 | { |
1034 | m_global_contactcount++; | 1032 | m_global_contactcount++; |
1035 | ncontacts++; | 1033 | if (m_global_contactcount >= maxContactsbeforedeath) |
1034 | break; | ||
1036 | 1035 | ||
1037 | Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); | 1036 | ncontacts++; |
1038 | d.JointAttach(Joint, b1, b2); | ||
1039 | 1037 | ||
1040 | if (curContact.depth > maxContact.depth) | 1038 | Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); |
1041 | maxContact = curContact; | 1039 | if (Joint == IntPtr.Zero) |
1040 | break; | ||
1042 | 1041 | ||
1043 | if (curContact.depth < minContact.depth) | 1042 | d.JointAttach(Joint, b1, b2); |
1044 | minContact = curContact; | ||
1045 | } | ||
1046 | } | ||
1047 | 1043 | ||
1048 | if (++i >= count) | 1044 | if (curContact.depth > maxContact.depth) |
1049 | break; | 1045 | maxContact = curContact; |
1050 | 1046 | ||
1051 | if (!GetCurContactGeom(i, ref curContact)) | 1047 | if (curContact.depth < minContact.depth) |
1052 | break; | 1048 | minContact = curContact; |
1049 | } | ||
1053 | } | 1050 | } |
1054 | 1051 | ||
1052 | if (++i >= count) | ||
1053 | break; | ||
1054 | |||
1055 | if (!GetCurContactGeom(i, ref curContact)) | ||
1056 | break; | ||
1057 | } | ||
1058 | |||
1055 | if (ncontacts > 0) | 1059 | if (ncontacts > 0) |
1056 | { | 1060 | { |
1057 | ContactPoint maxDepthContact = new ContactPoint( | 1061 | ContactPoint maxDepthContact = new ContactPoint( |