From 1918402cb181a39f8c085a409909dccb5c988aa1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 4 Aug 2011 03:08:35 +0100 Subject: if an NPC target is set to a ground location, then automatically land them when they get there. This doesn't help where the target is a prim surface. In these situations, it might be better to provide manual overrides so the script can control whethre an avatar flys there/lands, etc. --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 30e81fc..4f21d9d 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(); -- cgit v1.1