Fix excessive forward motion and flailing while descending a slope, prevent adding motion while falling from flying.

avinationmerge
Kitto Flora 2010-11-11 04:49:47 +00:00
parent ccfbce3176
commit 9462a1861b
2 changed files with 17 additions and 3 deletions

View File

@ -248,7 +248,7 @@ TrySetMovementAnimation("STAND");
m_animTickFall = Environment.TickCount; m_animTickFall = Environment.TickCount;
} }
// else if (!jumping && fallElapsed > FALL_DELAY) // 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 // Falling long enough to trigger the animation
//Console.WriteLine("FALLDOWN"); //## //Console.WriteLine("FALLDOWN"); //##

View File

@ -161,6 +161,8 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_setAlwaysRun; private bool m_setAlwaysRun;
private bool m_forceFly; private bool m_forceFly;
private bool m_flyDisabled; 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; private float m_speedModifier = 1.0f;
@ -2564,14 +2566,22 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 direc = vec * rotation; Vector3 direc = vec * rotation;
direc.Normalize(); direc.Normalize();
PhysicsActor actor = m_physicsActor; 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. if ((vec.Z == 0f) && !actor.Flying) direc.Z = 0f; // Prevent camera WASD up.
direc *= 0.03f * 128f * m_speedModifier; direc *= 0.03f * 128f * m_speedModifier;
if (actor != null) if (actor != null)
{ {
// rm falling if (actor.Flying) if (actor.Flying)
if ((actor.Flying) || Animator.m_falling) // add for falling lateral speed
{ {
// rm speed mod direc *= 4.0f; // rm speed mod direc *= 4.0f;
direc *= 5.2f; // for speed mod direc *= 5.2f; // for speed mod
@ -2587,6 +2597,10 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.Info("[AGENT]: Stop FLying"); // 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 /* This jumping section removed to SPA
else if (!actor.Flying && actor.IsColliding) else if (!actor.Flying && actor.IsColliding)
{ {