aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs68
1 files changed, 67 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7897564..fc89b2a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -896,6 +896,8 @@ namespace OpenSim.Region.Framework.Scenes
896 896
897 if (dm != null) 897 if (dm != null)
898 m_eventManager.OnPermissionError += dm.SendAlertToUser; 898 m_eventManager.OnPermissionError += dm.SendAlertToUser;
899
900 m_eventManager.OnSignificantClientMovement += HandleOnSignificantClientMovement;
899 } 901 }
900 902
901 public override string GetSimulatorVersion() 903 public override string GetSimulatorVersion()
@@ -5396,7 +5398,7 @@ namespace OpenSim.Region.Framework.Scenes
5396 return true; 5398 return true;
5397 } 5399 }
5398 5400
5399 public void StartTimerWatchdog() 5401 public void StartTimerWatchdog()
5400 { 5402 {
5401 m_timerWatchdog.Interval = 1000; 5403 m_timerWatchdog.Interval = 1000;
5402 m_timerWatchdog.Elapsed += TimerWatchdog; 5404 m_timerWatchdog.Elapsed += TimerWatchdog;
@@ -5407,6 +5409,70 @@ namespace OpenSim.Region.Framework.Scenes
5407 public void TimerWatchdog(object sender, ElapsedEventArgs e) 5409 public void TimerWatchdog(object sender, ElapsedEventArgs e)
5408 { 5410 {
5409 CheckHeartbeat(); 5411 CheckHeartbeat();
5412 }
5413
5414 /// This method deals with movement when an avatar is automatically moving (but this is distinct from the
5415 /// autopilot that moves an avatar to a sit target!.
5416 /// </summary>
5417 /// <remarks>
5418 /// This is not intended as a permament location for this method.
5419 /// </remarks>
5420 /// <param name="presence"></param>
5421 private void HandleOnSignificantClientMovement(ScenePresence presence)
5422 {
5423 if (presence.MovingToTarget)
5424 {
5425 double distanceToTarget = Util.GetDistanceTo(presence.AbsolutePosition, presence.MoveToPositionTarget);
5426// m_log.DebugFormat(
5427// "[SCENE]: Abs pos of {0} is {1}, target {2}, distance {3}",
5428// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget, distanceToTarget);
5429
5430 // Check the error term of the current position in relation to the target position
5431 if (distanceToTarget <= ScenePresence.SIGNIFICANT_MOVEMENT)
5432 {
5433 // We are close enough to the target
5434// m_log.DebugFormat("[SCENEE]: Stopping autopilot of {0}", presence.Name);
5435
5436 presence.Velocity = Vector3.Zero;
5437 presence.AbsolutePosition = presence.MoveToPositionTarget;
5438 presence.ResetMoveToTarget();
5439
5440 if (presence.PhysicsActor.Flying)
5441 {
5442 // A horrible hack to stop the avatar dead in its tracks rather than having them overshoot
5443 // the target if flying.
5444 // We really need to be more subtle (slow the avatar as it approaches the target) or at
5445 // least be able to set collision status once, rather than 5 times to give it enough
5446 // weighting so that that PhysicsActor thinks it really is colliding.
5447 for (int i = 0; i < 5; i++)
5448 presence.PhysicsActor.IsColliding = true;
5449
5450// Vector3 targetPos = presence.MoveToPositionTarget;
5451// if (m_avatars[presence.UUID].LandAtTarget)
5452// presence.PhysicsActor.Flying = false;
5453
5454// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y];
5455// if (targetPos.Z - terrainHeight < 0.2)
5456// {
5457// presence.PhysicsActor.Flying = false;
5458// }
5459 }
5460
5461// m_log.DebugFormat(
5462// "[SCENE]: AgentControlFlags {0}, MovementFlag {1} for {2}",
5463// presence.AgentControlFlags, presence.MovementFlag, presence.Name);
5464 }
5465 else
5466 {
5467// m_log.DebugFormat(
5468// "[SCENE]: Updating npc {0} at {1} for next movement to {2}",
5469// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
5470
5471 Vector3 agent_control_v3 = new Vector3();
5472 presence.HandleMoveToTargetUpdate(ref agent_control_v3);
5473 presence.AddNewMovement(agent_control_v3);
5474 }
5475 }
5410 } 5476 }
5411 } 5477 }
5412} 5478}