diff options
author | UbitUmarov | 2017-07-02 01:34:06 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-02 01:34:06 +0100 |
commit | f3a920237b479149537f39d203c824571123d032 (patch) | |
tree | 74cb5a06235862c8abfec540fafb4c403d8b31c1 | |
parent | a few changes to ubOde avatar collisions (diff) | |
download | opensim-SC_OLD-f3a920237b479149537f39d203c824571123d032.zip opensim-SC_OLD-f3a920237b479149537f39d203c824571123d032.tar.gz opensim-SC_OLD-f3a920237b479149537f39d203c824571123d032.tar.bz2 opensim-SC_OLD-f3a920237b479149537f39d203c824571123d032.tar.xz |
oops i forgot the avatar knees bending on ramps... so go back..
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 15 |
2 files changed, 33 insertions, 24 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index b0f3f52..6016530 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | |||
@@ -899,10 +899,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
899 | y = tx * sin + y * cos; | 899 | y = tx * sin + y * cos; |
900 | } | 900 | } |
901 | 901 | ||
902 | public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, | 902 | public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, |
903 | ref bool feetcollision) | 903 | ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) |
904 | { | 904 | { |
905 | feetcollision = false; | 905 | feetcollision = false; |
906 | useAltcontact = false; | ||
906 | 907 | ||
907 | if (me == capsule) | 908 | if (me == capsule) |
908 | { | 909 | { |
@@ -962,6 +963,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
962 | if(m_flying) | 963 | if(m_flying) |
963 | return true; | 964 | return true; |
964 | 965 | ||
966 | feetcollision = true; | ||
967 | if (h < boneOff) | ||
968 | { | ||
969 | m_collideNormal.X = contact.normal.X; | ||
970 | m_collideNormal.Y = contact.normal.Y; | ||
971 | m_collideNormal.Z = contact.normal.Z; | ||
972 | IsColliding = true; | ||
973 | } | ||
974 | |||
975 | altContact = contact; | ||
976 | useAltcontact = true; | ||
977 | |||
965 | offset.Z -= 0.2f; | 978 | offset.Z -= 0.2f; |
966 | 979 | ||
967 | offset.Normalize(); | 980 | offset.Normalize(); |
@@ -980,28 +993,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
980 | if (tdp > 0.25f) | 993 | if (tdp > 0.25f) |
981 | tdp = 0.25f; | 994 | tdp = 0.25f; |
982 | 995 | ||
983 | contact.depth = tdp; | 996 | altContact.depth = tdp; |
984 | 997 | ||
985 | if (reverse) | 998 | if (reverse) |
986 | { | 999 | { |
987 | contact.normal.X = offset.X; | 1000 | altContact.normal.X = offset.X; |
988 | contact.normal.Y = offset.Y; | 1001 | altContact.normal.Y = offset.Y; |
989 | contact.normal.Z = offset.Z; | 1002 | altContact.normal.Z = offset.Z; |
990 | } | 1003 | } |
991 | else | 1004 | else |
992 | { | 1005 | { |
993 | contact.normal.X = -offset.X; | 1006 | altContact.normal.X = -offset.X; |
994 | contact.normal.Y = -offset.Y; | 1007 | altContact.normal.Y = -offset.Y; |
995 | contact.normal.Z = -offset.Z; | 1008 | altContact.normal.Z = -offset.Z; |
996 | } | ||
997 | |||
998 | feetcollision = true; | ||
999 | if (h < boneOff) | ||
1000 | { | ||
1001 | m_collideNormal.X = contact.normal.X; | ||
1002 | m_collideNormal.Y = contact.normal.Y; | ||
1003 | m_collideNormal.Z = contact.normal.Z; | ||
1004 | IsColliding = true; | ||
1005 | } | 1009 | } |
1006 | return true; | 1010 | return true; |
1007 | } | 1011 | } |
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 0837bfb..844d02b 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -951,7 +951,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
951 | SharedTmpcontact.surface.mu = mu; | 951 | SharedTmpcontact.surface.mu = mu; |
952 | SharedTmpcontact.surface.bounce = bounce; | 952 | SharedTmpcontact.surface.bounce = bounce; |
953 | 953 | ||
954 | bool noskip = true; | 954 | d.ContactGeom altContact = new d.ContactGeom(); |
955 | bool useAltcontact; | ||
956 | bool noskip; | ||
955 | 957 | ||
956 | if(dop1ava || dop2ava) | 958 | if(dop1ava || dop2ava) |
957 | smoothMesh = false; | 959 | smoothMesh = false; |
@@ -959,10 +961,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
959 | while (true) | 961 | while (true) |
960 | { | 962 | { |
961 | noskip = true; | 963 | noskip = true; |
964 | useAltcontact = false; | ||
962 | 965 | ||
963 | if (dop1ava) | 966 | if (dop1ava) |
964 | { | 967 | { |
965 | if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref FeetCollision))) | 968 | if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) |
966 | { | 969 | { |
967 | if (p2.PhysicsActorType == (int)ActorTypes.Agent) | 970 | if (p2.PhysicsActorType == (int)ActorTypes.Agent) |
968 | { | 971 | { |
@@ -977,7 +980,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
977 | } | 980 | } |
978 | else if (dop2ava) | 981 | else if (dop2ava) |
979 | { | 982 | { |
980 | if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref FeetCollision))) | 983 | if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) |
981 | { | 984 | { |
982 | if (p1.PhysicsActorType == (int)ActorTypes.Agent) | 985 | if (p1.PhysicsActorType == (int)ActorTypes.Agent) |
983 | { | 986 | { |
@@ -993,8 +996,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
993 | 996 | ||
994 | if (noskip) | 997 | if (noskip) |
995 | { | 998 | { |
996 | Joint = CreateContacJoint(ref curContact,smoothMesh); | 999 | if(useAltcontact) |
997 | 1000 | Joint = CreateContacJoint(ref altContact,smoothMesh); | |
1001 | else | ||
1002 | Joint = CreateContacJoint(ref curContact,smoothMesh); | ||
998 | if (Joint == IntPtr.Zero) | 1003 | if (Joint == IntPtr.Zero) |
999 | break; | 1004 | break; |
1000 | 1005 | ||