Fix ground sit autopilot

avinationmerge
Melanie 2011-10-25 00:53:39 +02:00
parent 4a6160e7ad
commit 5f025d20fe
2 changed files with 19 additions and 9 deletions

View File

@ -26,6 +26,7 @@
*/ */
using System; using System;
using System.Threading;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
@ -169,6 +170,7 @@ TrySetMovementAnimation("STAND");
#region Inputs #region Inputs
AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags; AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags;
// m_log.DebugFormat("[ANIM]: Control flags: {0}", controlFlags);
PhysicsActor actor = m_scenePresence.PhysicsActor; PhysicsActor actor = m_scenePresence.PhysicsActor;
// Create forward and left vectors from the current avatar rotation // 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 // Direction in which the avatar is trying to move
Vector3 move = Vector3.Zero; 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 (heldBack) { move.X -= fwd.X; move.Y -= fwd.Y; }
if (heldLeft) { move.X += left.X; move.Y += left.Y; } if (heldLeft) { move.X += left.X; move.Y += left.Y; }
if (heldRight) { move.X -= left.X; move.Y -= left.Y; } if (heldRight) { move.X -= left.X; move.Y -= left.Y; }
if (heldUp) { move.Z += 1; } if (heldUp) { move.Z += 1; }
if (heldDown) { move.Z -= 1; } if (heldDown) { move.Z -= 1; }
if (heldForward) { move.X += fwd.X; move.Y += fwd.Y; }
// Is the avatar trying to move? // Is the avatar trying to move?
// bool moving = (move != Vector3.Zero); // bool moving = (move != Vector3.Zero);

View File

@ -1486,6 +1486,10 @@ namespace OpenSim.Region.Framework.Scenes
#endregion Inputs #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) if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
{ {
StandUp(); StandUp();
@ -1856,9 +1860,12 @@ namespace OpenSim.Region.Framework.Scenes
/// </param> /// </param>
public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget)
{ {
m_log.DebugFormat( if (SitGround)
"[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", StandUp();
Name, pos, m_scene.RegionInfo.RegionName);
// 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 if (pos.X < 0 || pos.X >= Constants.RegionSize
|| pos.Y < 0 || pos.Y >= Constants.RegionSize || pos.Y < 0 || pos.Y >= Constants.RegionSize
@ -1884,9 +1891,9 @@ namespace OpenSim.Region.Framework.Scenes
if (pos.Z - terrainHeight < 0.2) if (pos.Z - terrainHeight < 0.2)
pos.Z = terrainHeight; pos.Z = terrainHeight;
m_log.DebugFormat( // m_log.DebugFormat(
"[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", // "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); // Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
if (noFly) if (noFly)
PhysicsActor.Flying = false; PhysicsActor.Flying = false;
@ -1922,7 +1929,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ResetMoveToTarget() 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; MovingToTarget = false;
MoveToPositionTarget = Vector3.Zero; MoveToPositionTarget = Vector3.Zero;
@ -2061,7 +2068,8 @@ namespace OpenSim.Region.Framework.Scenes
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();
m_requestedSitTargetID = 0; m_requestedSitTargetID = 0;
} }
Animator.TrySetMovementAnimation("STAND");
Animator.UpdateMovementAnimations();
} }
private SceneObjectPart FindNextAvailableSitTarget(UUID targetID) private SceneObjectPart FindNextAvailableSitTarget(UUID targetID)