From c5c079f6aa731ae6505299c11792f4d1d6ea3e88 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Jan 2012 00:17:40 +0000 Subject: Fix bug where tapping home to stop falling would stop any avatar movement other than falling again. Addresses http://opensimulator.org/mantis/view.php?id=5839 --- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 13 ++++++------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index eda085f..ff5f731 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -223,7 +223,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animTickFall = 0; m_animTickJump = 0; m_jumping = false; - m_falling = true; + m_falling = false; m_jumpVelocity = 0f; actor.Selected = false; m_fallHeight = actor.Position.Z; // save latest flying height @@ -238,10 +238,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation } else if (move.Z < 0f) { - if (actor != null && actor.IsColliding) - { + if (actor != null && actor.IsColliding) return "LAND"; - } else return "HOVER_DOWN"; } @@ -260,7 +258,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation float fallElapsed = (float)(Environment.TickCount - m_animTickFall); float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f; - if (!m_jumping && (fallVelocity < -3.0f) ) m_falling = true; + if (!m_jumping && (fallVelocity < -3.0f)) + m_falling = true; if (m_animTickFall == 0 || (fallVelocity >= 0.0f)) { @@ -297,9 +296,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation return "PREJUMP"; } - if(m_jumping) + if (m_jumping) { - if ( (jumptime > (JUMP_PERIOD * 1.5f)) && actor.IsColliding) + if ((jumptime > (JUMP_PERIOD * 1.5f)) && actor.IsColliding) { // end jumping m_jumping = false; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 42cd4be..8ebb7a6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1274,8 +1274,8 @@ namespace OpenSim.Region.Framework.Scenes public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) { // m_log.DebugFormat( -// "[SCENE PRESENCE]: In {0} received agent update from {1}", -// Scene.RegionInfo.RegionName, remoteClient.Name); +// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", +// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags); if (IsChildAgent) { @@ -2312,6 +2312,8 @@ namespace OpenSim.Region.Framework.Scenes /// The vector in which to move. This is relative to the rotation argument public void AddNewMovement(Vector3 vec) { +// m_log.DebugFormat("[SCENE PRESENCE]: Adding new movement {0} for {1}", vec, Name); + Vector3 direc = vec * Rotation; direc.Normalize(); -- cgit v1.1 From ba163ab05b2f05bf9a316a5f209f64992d4f9a22 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Jan 2012 00:29:55 +0000 Subject: Add method doc to SPA.Falling and use automatic private get property --- .../Scenes/Animation/ScenePresenceAnimator.cs | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index ff5f731..3584cda 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -61,11 +61,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation public bool m_jumping = false; public float m_jumpVelocity = 0f; // private int m_landing = 0; - public bool Falling - { - get { return m_falling; } - } - private bool m_falling = false; + + /// + /// Is the avatar falling? + /// + public bool Falling { get; private set; } + private float m_fallHeight; /// @@ -223,7 +224,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_animTickFall = 0; m_animTickJump = 0; m_jumping = false; - m_falling = false; + Falling = false; m_jumpVelocity = 0f; actor.Selected = false; m_fallHeight = actor.Position.Z; // save latest flying height @@ -259,7 +260,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f; if (!m_jumping && (fallVelocity < -3.0f)) - m_falling = true; + Falling = true; if (m_animTickFall == 0 || (fallVelocity >= 0.0f)) { @@ -289,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // Start jumping, prejump m_animTickFall = 0; m_jumping = true; - m_falling = false; + Falling = false; actor.Selected = true; // borrowed for jumping flag m_animTickJump = Environment.TickCount; m_jumpVelocity = 0.35f; @@ -302,7 +303,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation { // end jumping m_jumping = false; - m_falling = false; + Falling = false; actor.Selected = false; // borrowed for jumping flag m_jumpVelocity = 0f; m_animTickFall = Environment.TickCount; @@ -329,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (CurrentMovementAnimation == "FALLDOWN") { - m_falling = false; + Falling = false; m_animTickFall = Environment.TickCount; // TODO: SOFT_LAND support float fallHeight = m_fallHeight - actor.Position.Z; @@ -363,7 +364,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (move.X != 0f || move.Y != 0f) { m_fallHeight = actor.Position.Z; // save latest flying height - m_falling = false; + Falling = false; // Walking / crouchwalking / running if (move.Z < 0f) return "CROUCHWALK"; @@ -374,7 +375,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation } else if (!m_jumping) { - m_falling = false; + Falling = false; // Not walking if (move.Z < 0) return "CROUCH"; @@ -387,7 +388,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation } #endregion Ground Movement - m_falling = false; + Falling = false; return CurrentMovementAnimation; } -- cgit v1.1