From 6473674bbf6ce006512083902e8ff1796d8c8b22 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 23 Apr 2012 19:07:36 +0300 Subject: Fixed: custom walking animations didn't stop when the avatar stopped walking. This happened because the scripts were notified about control changes (e.g., the user stopped pressing the Forward key) when the animation was still WALK, so the script didn't stop the walking animation. Fixing this required: a) Update the movement animation *before* notifying the script; b) Add locking to prevent clashes with the Heartbeat thread (which also updates the animations); c) Handle the case of a user who stops walking just as the avatar is in the air: the avatar should STAND in that case, not WALK. This reverts commit feef1dd73243cfdd5322632fb67e64cabc1ad4bc. --- .../Scenes/Animation/ScenePresenceAnimator.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Animation') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index f5623bd..14ae287 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -278,6 +278,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation return "FALLDOWN"; } + // Check if the user has stopped walking just now + if (CurrentMovementAnimation == "WALK" && (move == Vector3.Zero)) + return "STAND"; + return CurrentMovementAnimation; } @@ -402,13 +406,16 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public void UpdateMovementAnimations() { - CurrentMovementAnimation = DetermineMovementAnimation(); + lock (m_animations) + { + CurrentMovementAnimation = DetermineMovementAnimation(); -// m_log.DebugFormat( -// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", -// CurrentMovementAnimation, m_scenePresence.Name); +// m_log.DebugFormat( +// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", +// CurrentMovementAnimation, m_scenePresence.Name); - TrySetMovementAnimation(CurrentMovementAnimation); + TrySetMovementAnimation(CurrentMovementAnimation); + } } public UUID[] GetAnimationArray() -- cgit v1.1