From fd0e65b0b17c2985d4dd8199e16fbc84d9929dad Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 20 Oct 2011 23:11:53 +0200 Subject: Fix up the animator and ScenePresence to like each other again --- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 14 +++++++------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index f54b071..e4e5ab6 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public class ScenePresenceAnimator { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public AnimationSet Animations { @@ -181,8 +181,8 @@ TrySetMovementAnimation("STAND"); bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); bool heldLeft = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS); bool heldRight = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG); - bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; - bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; + //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; + //bool heldTurnRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_RIGHT; bool heldUp = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) == AgentManager.ControlFlags.AGENT_CONTROL_UP_POS; bool heldDown = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG; //bool flying = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) == AgentManager.ControlFlags.AGENT_CONTROL_FLY; @@ -413,10 +413,10 @@ TrySetMovementAnimation("STAND"); // Not walking if (move.Z < 0) return "CROUCH"; - else if (heldTurnLeft) - return "TURNLEFT"; - else if (heldTurnRight) - return "TURNRIGHT"; +// else if (heldTurnLeft) +// return "TURNLEFT"; +// else if (heldTurnRight) +// return "TURNRIGHT"; else return "STAND"; } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 975d855..1f39c3f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2703,6 +2703,19 @@ namespace OpenSim.Region.Framework.Scenes Vector3 direc = vec * Rotation; direc.Normalize(); + if (PhysicsActor.Flying != m_flyingOld) // add for fly velocity control + { + m_flyingOld = PhysicsActor.Flying; // add for fly velocity control + if (!PhysicsActor.Flying) + m_wasFlying = true; // add for fly velocity control + } + + if (PhysicsActor.IsColliding == true) + m_wasFlying = false; // add for fly velocity control + + if ((vec.Z == 0f) && !PhysicsActor.Flying) + direc.Z = 0f; // Prevent camera WASD up. + direc *= 0.03f * 128f * SpeedModifier; if (PhysicsActor != null) @@ -2721,6 +2734,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; + } else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) { if (direc.Z > 2.0f) -- cgit v1.1