From 9462a1861b3a10467370380d11cf2e82a91c4ab7 Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Thu, 11 Nov 2010 04:49:47 +0000 Subject: Fix excessive forward motion and flailing while descending a slope, prevent adding motion while falling from flying. --- .../Scenes/Animation/ScenePresenceAnimator.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 9658e11..9c103cb 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -248,7 +248,7 @@ TrySetMovementAnimation("STAND"); m_animTickFall = Environment.TickCount; } // else if (!jumping && fallElapsed > FALL_DELAY) - else if (!m_jumping && (fallElapsed > FALL_DELAY) && (fallVelocity < -3.0f) ) // add for falling and jumping + else if (!m_jumping && (fallElapsed > FALL_DELAY) && (fallVelocity < -3.0f) && (m_scenePresence.m_wasFlying)) // add for falling and jumping { // Falling long enough to trigger the animation //Console.WriteLine("FALLDOWN"); //## diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b637317..f20eb33 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -161,6 +161,8 @@ namespace OpenSim.Region.Framework.Scenes private bool m_setAlwaysRun; private bool m_forceFly; private bool m_flyDisabled; + private bool m_flyingOld; // add for fly velocity control + public bool m_wasFlying; // add for fly velocity control private float m_speedModifier = 1.0f; @@ -2564,14 +2566,22 @@ namespace OpenSim.Region.Framework.Scenes Vector3 direc = vec * rotation; direc.Normalize(); PhysicsActor actor = m_physicsActor; + + if (actor.Flying != m_flyingOld) // add for fly velocity control + { + m_flyingOld = actor.Flying; // add for fly velocity control + if (!actor.Flying) m_wasFlying = true; // add for fly velocity control + } + + if (m_physicsActor.IsColliding == true) m_wasFlying = false; // add for fly velocity control + if ((vec.Z == 0f) && !actor.Flying) direc.Z = 0f; // Prevent camera WASD up. direc *= 0.03f * 128f * m_speedModifier; if (actor != null) { -// rm falling if (actor.Flying) - if ((actor.Flying) || Animator.m_falling) // add for falling lateral speed + if (actor.Flying) { // rm speed mod direc *= 4.0f; direc *= 5.2f; // for speed mod @@ -2587,6 +2597,10 @@ namespace OpenSim.Region.Framework.Scenes // m_log.Info("[AGENT]: Stop FLying"); //} } + if (Animator.m_falling && m_wasFlying) // if falling from flying, disable motion add + { + direc *= 0.0f; + } /* This jumping section removed to SPA else if (!actor.Flying && actor.IsColliding) { -- cgit v1.1