diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 17b55bf2d4..d40132e46b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1537,8 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) - && !SitGround - && !MovingToTarget) + && !SitGround) Animator.UpdateMovementAnimations(); } @@ -1711,9 +1710,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 (pos.Z > terrainHeight) PhysicsActor.Flying = true; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 30e81fc72e..4f21d9d4ec 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -72,8 +72,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC // Check the error term of the current position in relation to the target position if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) { - m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); // We are close enough to the target + m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); + + if (presence.PhysicsActor.Flying) + { + Vector3 targetPos = presence.MoveToPositionTarget; + float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; + if (targetPos.Z - terrainHeight < 0.2) + { + presence.PhysicsActor.Flying = false; + } + } + presence.Velocity = Vector3.Zero; presence.AbsolutePosition = presence.MoveToPositionTarget; presence.ResetMoveToTarget();