From 10d3d0c81de69106cd0a4f4a6d4f94310f595f43 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 12 Oct 2014 01:14:54 +0100 Subject: [PATCH] try to reduce avatar bounce on falls. Not all possible side effects checked, specially on portals --- .../Physics/UbitOdePlugin/ODECharacter.cs | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index af7ca1d475..1c38246d11 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs @@ -311,9 +311,9 @@ namespace OpenSim.Region.Physics.OdePlugin { if (value) { - m_colliderfilter += 2; - if (m_colliderfilter > 2) - m_colliderfilter = 2; + m_colliderfilter += 3; + if (m_colliderfilter > 3) + m_colliderfilter = 3; } else { @@ -328,6 +328,7 @@ namespace OpenSim.Region.Physics.OdePlugin { m_pidControllerActive = true; m_iscolliding = true; + m_freemove = false; } } } @@ -928,19 +929,6 @@ namespace OpenSim.Region.Physics.OdePlugin IsColliding = true; } } -/* - if (contact.normal.Z < 0.2f) - { - contact.normal.Z = 0; - float t = contact.normal.X * contact.normal.X + contact.normal.Y * contact.normal.Y; - if (t > 0) - { - t = 1.0f / t; - contact.normal.X *= t; - contact.normal.Y *= t; - } - } - */ return true; } @@ -1204,12 +1192,18 @@ namespace OpenSim.Region.Physics.OdePlugin // Avatar to Avatar collisions // Prim to avatar collisions - vec.X = -vel.X * PID_D + (_zeroPosition.X - localpos.X) * (PID_P * 5); - vec.Y = -vel.Y * PID_D + (_zeroPosition.Y - localpos.Y) * (PID_P * 5); + vec.X = -vel.X * PID_D * 2f + (_zeroPosition.X - localpos.X) * (PID_P * 5); + vec.Y = -vel.Y * PID_D * 2f + (_zeroPosition.Y - localpos.Y) * (PID_P * 5); + if(vel.Z > 0) + vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; + else + vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f; +/* if (flying) { vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; } +*/ } //PidStatus = true; } @@ -1226,7 +1220,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (ctz.Z > 0f) { // moving up or JUMPING - vec.Z += (ctz.Z - vel.Z) * PID_D; + vec.Z += (ctz.Z - vel.Z) * PID_D * 2f; vec.X += (ctz.X - vel.X) * (PID_D); vec.Y += (ctz.Y - vel.Y) * (PID_D); } @@ -1236,7 +1230,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (ctz.Z == 0) { if (vel.Z > 0) - vec.Z -= vel.Z * PID_D; + vec.Z -= vel.Z * PID_D * 2f; vec.X += (ctz.X - vel.X) * (PID_D); vec.Y += (ctz.Y - vel.Y) * (PID_D); } @@ -1305,9 +1299,9 @@ namespace OpenSim.Region.Physics.OdePlugin vec.X -= breakfactor * vel.X; vec.Y -= breakfactor * vel.Y; if (flying) - vec.Z -= breakfactor * vel.Z; + vec.Z -= 0.5f * breakfactor * vel.Z; else - vec.Z -= .5f* m_mass * vel.Z; + vec.Z -= .16f* m_mass * vel.Z; } if (flying) @@ -1687,9 +1681,9 @@ namespace OpenSim.Region.Physics.OdePlugin _zeroFlag = false; _target_velocity = Vector3.Zero; m_freemove = true; - m_colliderfilter = -2; - m_colliderObjectfilter = -2; - m_colliderGroundfilter = -2; + m_colliderfilter = -1; + m_colliderObjectfilter = -1; + m_colliderGroundfilter = -1; m_iscolliding = false; m_iscollidingGround = false;