diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index de7e879565..b0f3f526fd 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -103,7 +103,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public float walkDivisor = 1.3f; public float runDivisor = 0.8f; - private bool flying = false; + private bool m_flying = false; private bool m_iscolliding = false; private bool m_iscollidingGround = false; private bool m_iscollidingObj = false; @@ -298,10 +298,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override bool Flying { - get { return flying; } + get { return m_flying; } set { - flying = value; + m_flying = value; // m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); } } @@ -900,10 +900,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, - ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) + ref bool feetcollision) { feetcollision = false; - useAltcontact = false; if (me == capsule) { @@ -943,12 +942,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } return true; } -/* - d.AABB aabb; - d.GeomGetAABB(other,out aabb); - float othertop = aabb.MaxZ - _position.Z; -*/ -// if (offset.Z > 0 || othertop > -feetOff || contact.normal.Z > 0.35f) + if (offset.Z > 0 || contact.normal.Z > 0.35f) { if (offset.Z <= 0) @@ -965,27 +959,40 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; } - altContact = contact; - useAltcontact = true; + if(m_flying) + return true; offset.Z -= 0.2f; offset.Normalize(); - if (contact.depth > 0.1f) - contact.depth = 0.1f; + float tdp = contact.depth; + float t = contact.normal.Z * contact.normal.Z; + t = Math.Abs(t); + if(t > 1e-6) + { + tdp /= t; + tdp *= offset.Z * offset.Z; + } + else + tdp *= 10; + + if (tdp > 0.25f) + tdp = 0.25f; + + contact.depth = tdp; if (reverse) { - altContact.normal.X = offset.X; - altContact.normal.Y = offset.Y; - altContact.normal.Z = offset.Z; + contact.normal.X = offset.X; + contact.normal.Y = offset.Y; + contact.normal.Z = offset.Z; } else { - altContact.normal.X = -offset.X; - altContact.normal.Y = -offset.Y; - altContact.normal.Z = -offset.Z; + contact.normal.X = -offset.X; + contact.normal.Y = -offset.Y; + contact.normal.Z = -offset.Z; } feetcollision = true; @@ -1098,7 +1105,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde float ftmp; - if (flying) + if (m_flying) { ftmp = timeStep; posch.X += vel.X * ftmp; @@ -1122,7 +1129,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde vec.Z = depth * PID_P * 50; - if (!flying) + if (!m_flying) { vec.Z += -vel.Z * PID_D; if(n.Z < 0.4f) @@ -1259,7 +1266,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // movement relative to surface if moving on it // dont disturbe vertical movement, ie jumps - if (m_iscolliding && !flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) + if (m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) { float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); @@ -1276,7 +1283,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { // if velocity is zero, use position control; otherwise, velocity control - if (tviszero && m_iscolliding && !flying) + if (tviszero && m_iscolliding && !m_flying) { // keep track of where we stopped. No more slippin' & slidin' if (!_zeroFlag) @@ -1313,7 +1320,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_iscolliding) { - if (!flying) + if (!m_flying) { // we are on a surface if (ctz.Z > 0f) @@ -1361,7 +1368,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else // ie not colliding { - if (flying || hoverPIDActive) //(!m_iscolliding && flying) + if (m_flying || hoverPIDActive) //(!m_iscolliding && flying) { // we're in mid air suspended vec.X += (ctz.X - vel.X) * (PID_D); @@ -1397,13 +1404,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde breakfactor = m_mass; vec.X -= breakfactor * vel.X; vec.Y -= breakfactor * vel.Y; - if (flying) + if (m_flying) vec.Z -= 0.5f * breakfactor * vel.Z; else vec.Z -= .16f* m_mass * vel.Z; } - if (flying || hoverPIDActive) + if (m_flying || hoverPIDActive) { vec.Z -= m_parent_scene.gravityz * m_mass; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 86d41eabf2..0837bfb363 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -951,8 +951,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde SharedTmpcontact.surface.mu = mu; SharedTmpcontact.surface.bounce = bounce; - d.ContactGeom altContact = new d.ContactGeom(); - bool useAltcontact = false; bool noskip = true; if(dop1ava || dop2ava) @@ -961,11 +959,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde while (true) { noskip = true; - useAltcontact = false; if (dop1ava) { - if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) + if ((((OdeCharacter)p1).Collide(g1, g2, false, ref curContact, ref FeetCollision))) { if (p2.PhysicsActorType == (int)ActorTypes.Agent) { @@ -980,7 +977,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else if (dop2ava) { - if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref altContact , ref useAltcontact, ref FeetCollision))) + if ((((OdeCharacter)p2).Collide(g2, g1, true, ref curContact, ref FeetCollision))) { if (p1.PhysicsActorType == (int)ActorTypes.Agent) { @@ -996,10 +993,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (noskip) { - if(useAltcontact) - Joint = CreateContacJoint(ref altContact,smoothMesh); - else - Joint = CreateContacJoint(ref curContact,smoothMesh); + Joint = CreateContacJoint(ref curContact,smoothMesh); if (Joint == IntPtr.Zero) break; diff --git a/bin/config-include/osslEnable.ini b/bin/config-include/osslEnable.ini index 5f9eeb8e5c..5987952bdc 100644 --- a/bin/config-include/osslEnable.ini +++ b/bin/config-include/osslEnable.ini @@ -61,7 +61,6 @@ ; osslParcelOG = "PARCEL_GROUP_MEMBER,PARCEL_OWNER," ; NPC macros - ; There are a block of macros to creating and controlling NPCs. ; These can be mis-used so limit use to those you can trust. osslNPC = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER diff --git a/bin/lib32/ode.dll b/bin/lib32/ode.dll index 5636903c48..f7677d2361 100755 Binary files a/bin/lib32/ode.dll and b/bin/lib32/ode.dll differ diff --git a/bin/lib64/ode.dll b/bin/lib64/ode.dll index fdc0dddee5..87ece28b57 100755 Binary files a/bin/lib64/ode.dll and b/bin/lib64/ode.dll differ