From 5f2a65c9762f626bc3389bcd85ae20e45aa09b04 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 20 Mar 2012 20:28:58 +0000 Subject: [PATCH 1/3] refactor: Eliminate unnecessary duplicate avCapsuleTilted --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 598530c50f..1f8c2ca6b2 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -181,8 +181,12 @@ namespace OpenSim.Region.Physics.OdePlugin private float avPIDP = 1400f; private float avCapRadius = 0.37f; private float avStandupTensor = 2000000f; - private bool avCapsuleTilted = true; // true = old compatibility mode with leaning capsule; false = new corrected mode - public bool IsAvCapsuleTilted { get { return avCapsuleTilted; } set { avCapsuleTilted = value; } } + + /// + /// true = old compatibility mode with leaning capsule; false = new corrected mode + /// + public bool IsAvCapsuleTilted { get; private set; } + private float avDensity = 80f; // private float avHeightFudgeFactor = 0.52f; private float avMovementDivisorWalk = 1.3f; @@ -501,7 +505,7 @@ namespace OpenSim.Region.Physics.OdePlugin avMovementDivisorWalk = physicsconfig.GetFloat("av_movement_divisor_walk", 1.3f); avMovementDivisorRun = physicsconfig.GetFloat("av_movement_divisor_run", 0.8f); avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); - avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", false); + IsAvCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", false); contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", 80); From 86bd287b5346063edb0f62ceb96ee08c6ee80c18 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 20 Mar 2012 20:39:33 +0000 Subject: [PATCH 2/3] refactor: precalculate the fixed movement factor for avatar tilting (sqrt(2)) rather than doing it multiple times on every move. --- .../Region/Physics/OdePlugin/ODECharacter.cs | 21 ++++++++++++------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 3 +++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 6d1f41da05..8397eb4331 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -114,6 +114,11 @@ namespace OpenSim.Region.Physics.OdePlugin private float m_tainted_CAPSULE_LENGTH; // set when the capsule length changes. + /// + /// Base movement for calculating tilt. + /// + private float m_tiltBaseMovement = (float)Math.Sqrt(2); + /// /// Used to introduce a fixed tilt because a straight-up capsule falls through terrain, probably a bug in terrain collider /// @@ -524,14 +529,14 @@ namespace OpenSim.Region.Physics.OdePlugin if (movementVector.Y > 0) { // northeast - movementVector.X = (float)Math.Sqrt(2.0); - movementVector.Y = (float)Math.Sqrt(2.0); + movementVector.X = m_tiltBaseMovement; + movementVector.Y = m_tiltBaseMovement; } else { // southeast - movementVector.X = (float)Math.Sqrt(2.0); - movementVector.Y = -(float)Math.Sqrt(2.0); + movementVector.X = m_tiltBaseMovement; + movementVector.Y = -m_tiltBaseMovement; } } else @@ -540,14 +545,14 @@ namespace OpenSim.Region.Physics.OdePlugin if (movementVector.Y > 0) { // northwest - movementVector.X = -(float)Math.Sqrt(2.0); - movementVector.Y = (float)Math.Sqrt(2.0); + movementVector.X = -m_tiltBaseMovement; + movementVector.Y = m_tiltBaseMovement; } else { // southwest - movementVector.X = -(float)Math.Sqrt(2.0); - movementVector.Y = -(float)Math.Sqrt(2.0); + movementVector.X = -m_tiltBaseMovement; + movementVector.Y = -m_tiltBaseMovement; } } diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 1f8c2ca6b2..842ff916dc 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -185,6 +185,9 @@ namespace OpenSim.Region.Physics.OdePlugin /// /// true = old compatibility mode with leaning capsule; false = new corrected mode /// + /// + /// Even when set to false, the capsule still tilts but this is done in a different way. + /// public bool IsAvCapsuleTilted { get; private set; } private float avDensity = 80f; From 9ed3532c1b4fdbf8283e86ba7fb6f2706a5cfb97 Mon Sep 17 00:00:00 2001 From: nebadon Date: Tue, 20 Mar 2012 13:45:38 -0700 Subject: [PATCH 3/3] reduce avatar verticle jump from the absurd 5 meter jump to a less absurd 3m vertical jump to better match what you would see in Second Life and be more in line with what users would expect. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b84660a1be..82f6486645 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2293,7 +2293,7 @@ namespace OpenSim.Region.Framework.Scenes { if (direc.Z > 2.0f) { - direc.Z *= 3.0f; + direc.Z *= 2.5f; // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. Animator.TrySetMovementAnimation("PREJUMP");