diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 13 |
1 files changed, 12 insertions, 1 deletions
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 | |||
72 | // Check the error term of the current position in relation to the target position | 72 | // Check the error term of the current position in relation to the target position |
73 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) | 73 | if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT) |
74 | { | 74 | { |
75 | m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); | ||
76 | // We are close enough to the target | 75 | // We are close enough to the target |
76 | m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); | ||
77 | |||
78 | if (presence.PhysicsActor.Flying) | ||
79 | { | ||
80 | Vector3 targetPos = presence.MoveToPositionTarget; | ||
81 | float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; | ||
82 | if (targetPos.Z - terrainHeight < 0.2) | ||
83 | { | ||
84 | presence.PhysicsActor.Flying = false; | ||
85 | } | ||
86 | } | ||
87 | |||
77 | presence.Velocity = Vector3.Zero; | 88 | presence.Velocity = Vector3.Zero; |
78 | presence.AbsolutePosition = presence.MoveToPositionTarget; | 89 | presence.AbsolutePosition = presence.MoveToPositionTarget; |
79 | presence.ResetMoveToTarget(); | 90 | presence.ResetMoveToTarget(); |