From 5f025d20fe9aa8449f446f33d9147ddb27e2d5be Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 25 Oct 2011 00:53:39 +0200 Subject: Fix ground sit autopilot --- .../Scenes/Animation/ScenePresenceAnimator.cs | 4 +++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++++-------- 2 files changed, 19 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 e4e5ab6..175e8ed 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -26,6 +26,7 @@ */ using System; +using System.Threading; using System.Collections.Generic; using System.Reflection; using log4net; @@ -169,6 +170,7 @@ TrySetMovementAnimation("STAND"); #region Inputs AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags; +// m_log.DebugFormat("[ANIM]: Control flags: {0}", controlFlags); PhysicsActor actor = m_scenePresence.PhysicsActor; // Create forward and left vectors from the current avatar rotation @@ -190,12 +192,12 @@ TrySetMovementAnimation("STAND"); // Direction in which the avatar is trying to move Vector3 move = Vector3.Zero; - if (heldForward) { move.X += fwd.X; move.Y += fwd.Y; } if (heldBack) { move.X -= fwd.X; move.Y -= fwd.Y; } if (heldLeft) { move.X += left.X; move.Y += left.Y; } if (heldRight) { move.X -= left.X; move.Y -= left.Y; } if (heldUp) { move.Z += 1; } if (heldDown) { move.Z -= 1; } + if (heldForward) { move.X += fwd.X; move.Y += fwd.Y; } // Is the avatar trying to move? // bool moving = (move != Vector3.Zero); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9884acd..d43f67f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1486,6 +1486,10 @@ namespace OpenSim.Region.Framework.Scenes #endregion Inputs + // Make anims work for client side autopilot + if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) + m_updateCount = UPDATE_COUNT; + if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) { StandUp(); @@ -1856,9 +1860,12 @@ namespace OpenSim.Region.Framework.Scenes /// public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) { - m_log.DebugFormat( - "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", - Name, pos, m_scene.RegionInfo.RegionName); + if (SitGround) + StandUp(); + +// m_log.DebugFormat( +// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", +// Name, pos, m_scene.RegionInfo.RegionName); if (pos.X < 0 || pos.X >= Constants.RegionSize || pos.Y < 0 || pos.Y >= Constants.RegionSize @@ -1884,9 +1891,9 @@ namespace OpenSim.Region.Framework.Scenes if (pos.Z - terrainHeight < 0.2) pos.Z = terrainHeight; - m_log.DebugFormat( - "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", - Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat( +// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", +// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); if (noFly) PhysicsActor.Flying = false; @@ -1922,7 +1929,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ResetMoveToTarget() { - m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); +// m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); MovingToTarget = false; MoveToPositionTarget = Vector3.Zero; @@ -2061,7 +2068,8 @@ namespace OpenSim.Region.Framework.Scenes SendAvatarDataToAllAgents(); m_requestedSitTargetID = 0; } - Animator.TrySetMovementAnimation("STAND"); + + Animator.UpdateMovementAnimations(); } private SceneObjectPart FindNextAvailableSitTarget(UUID targetID) -- cgit v1.1