From 0639e90f56dbbe94fa33d0f24d593a3bb67a11d1 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 12 Dec 2009 02:41:59 -0500 Subject: [PATCH] * Bugfix mantis 4441, "Use of Autopilot isn't playing any animations." * Turns out the new animator used a different movement bitflag then the one used in the code to autopilot the avatar --- .../Scenes/Animation/ScenePresenceAnimator.cs | 2 +- .../Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index a459ffa60c..c314596a20 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -128,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (!m_scenePresence.IsChildAgent) { if (m_animations.TrySetDefaultAnimation( - anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) + anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) { // 16384 is CHANGED_ANIMATION m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7cdbd4b6de..2710cffceb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1262,11 +1262,13 @@ namespace OpenSim.Region.Framework.Scenes { return; } + + bool update_movementflag = false; if (m_allowMovement) { int i = 0; - bool update_movementflag = false; + bool update_rotation = false; bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = Vector3.Zero; @@ -1400,27 +1402,33 @@ namespace OpenSim.Region.Framework.Scenes if (LocalVectorToTarget2D.Y > 0)//MoveLeft { m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; + //AgentControlFlags + AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; update_movementflag = true; } else if (LocalVectorToTarget2D.Y < 0) //MoveRight { m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; + AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; update_movementflag = true; } if (LocalVectorToTarget2D.X < 0) //MoveBack { m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; + AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; update_movementflag = true; } else if (LocalVectorToTarget2D.X > 0) //Move Forward { m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; + AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; update_movementflag = true; } } - catch (Exception) + catch (Exception e) { //Avoid system crash, can be slower but... + m_log.DebugFormat("Crash! {0}", e.ToString()); } } } @@ -1458,11 +1466,13 @@ namespace OpenSim.Region.Framework.Scenes AddNewMovement(agent_control_v3, q); - if (update_movementflag) - Animator.UpdateMovementAnimations(); + } } + if (update_movementflag) + Animator.UpdateMovementAnimations(); + m_scene.EventManager.TriggerOnClientMovement(this); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));