From f3a920237b479149537f39d203c824571123d032 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 2 Jul 2017 01:34:06 +0100 Subject: [PATCH] oops i forgot the avatar knees bending on ramps... so go back.. --- .../PhysicsModules/ubOde/ODECharacter.cs | 42 ++++++++++--------- .../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 b0f3f526fd..6016530ba5 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -899,10 +899,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde y = tx * sin + y * cos; } - public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, - ref bool feetcollision) - { + public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, + ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) + { feetcollision = false; + useAltcontact = false; if (me == capsule) { @@ -962,6 +963,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(m_flying) return true; + feetcollision = true; + if (h < boneOff) + { + m_collideNormal.X = contact.normal.X; + m_collideNormal.Y = contact.normal.Y; + m_collideNormal.Z = contact.normal.Z; + IsColliding = true; + } + + altContact = contact; + useAltcontact = true; + offset.Z -= 0.2f; offset.Normalize(); @@ -980,28 +993,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (tdp > 0.25f) tdp = 0.25f; - contact.depth = tdp; + altContact.depth = tdp; if (reverse) { - contact.normal.X = offset.X; - contact.normal.Y = offset.Y; - contact.normal.Z = offset.Z; + altContact.normal.X = offset.X; + altContact.normal.Y = offset.Y; + altContact.normal.Z = offset.Z; } else { - contact.normal.X = -offset.X; - contact.normal.Y = -offset.Y; - contact.normal.Z = -offset.Z; - } - - feetcollision = true; - if (h < boneOff) - { - m_collideNormal.X = contact.normal.X; - m_collideNormal.Y = contact.normal.Y; - m_collideNormal.Z = contact.normal.Z; - IsColliding = true; + altContact.normal.X = -offset.X; + altContact.normal.Y = -offset.Y; + altContact.normal.Z = -offset.Z; } return true; } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 0837bfb363..844d02bad1 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -951,7 +951,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde SharedTmpcontact.surface.mu = mu; SharedTmpcontact.surface.bounce = bounce; - bool noskip = true; + d.ContactGeom altContact = new d.ContactGeom(); + bool useAltcontact; + bool noskip; if(dop1ava || dop2ava) smoothMesh = false; @@ -959,10 +961,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde while (true) { noskip = true; + useAltcontact = false; if (dop1ava) { - if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref FeetCollision))) + if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) { if (p2.PhysicsActorType == (int)ActorTypes.Agent) { @@ -977,7 +980,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else if (dop2ava) { - if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref FeetCollision))) + if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) { if (p1.PhysicsActorType == (int)ActorTypes.Agent) { @@ -993,8 +996,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (noskip) { - Joint = CreateContacJoint(ref curContact,smoothMesh); - + if(useAltcontact) + Joint = CreateContacJoint(ref altContact,smoothMesh); + else + Joint = CreateContacJoint(ref curContact,smoothMesh); if (Joint == IntPtr.Zero) break;