aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 018c2e2..6bce406 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2587,10 +2587,10 @@ namespace OpenSim.Region.Framework.Scenes
2587 } 2587 }
2588 2588
2589 bool update_movementflag = false; 2589 bool update_movementflag = false;
2590 2590 bool mvToTarget = MovingToTarget;
2591 if (agentData.UseClientAgentPosition) 2591 if (agentData.UseClientAgentPosition)
2592 { 2592 {
2593 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; 2593 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).LengthSquared() > 0.04f;
2594 MoveToPositionTarget = agentData.ClientAgentPosition; 2594 MoveToPositionTarget = agentData.ClientAgentPosition;
2595 } 2595 }
2596 2596
@@ -2604,6 +2604,8 @@ namespace OpenSim.Region.Framework.Scenes
2604 newFlying = true; 2604 newFlying = true;
2605 else if (FlyDisabled) 2605 else if (FlyDisabled)
2606 newFlying = false; 2606 newFlying = false;
2607 else if(mvToTarget)
2608 newFlying = actor.Flying;
2607 else 2609 else
2608 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 2610 newFlying = ((flags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
2609 2611
@@ -3071,24 +3073,25 @@ namespace OpenSim.Region.Framework.Scenes
3071// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 3073// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
3072// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 3074// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
3073 3075
3076 bool shouldfly = Flying;
3074 if (noFly) 3077 if (noFly)
3075 Flying = false; 3078 shouldfly = false;
3076 else if (pos.Z > terrainHeight || Flying) 3079 else if (pos.Z > terrainHeight || Flying)
3077 Flying = true; 3080 shouldfly = true;
3078 3081
3079 LandAtTarget = landAtTarget; 3082 LandAtTarget = landAtTarget;
3080 MovingToTarget = true; 3083 MovingToTarget = true;
3081 MoveToPositionTarget = pos; 3084 MoveToPositionTarget = pos;
3085 Flying = shouldfly;
3082 3086
3083 // Rotate presence around the z-axis to point in same direction as movement. 3087 // Rotate presence around the z-axis to point in same direction as movement.
3084 // Ignore z component of vector 3088 // Ignore z component of vector
3085 Vector3 localVectorToTarget3D = pos - AbsolutePosition; 3089 Vector3 localVectorToTarget3D = pos - AbsolutePosition;
3086 Vector3 localVectorToTarget2D = new Vector3((float)(localVectorToTarget3D.X), (float)(localVectorToTarget3D.Y), 0f);
3087 3090
3088// m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0}", localVectorToTarget2D); 3091// m_log.DebugFormat("[SCENE PRESENCE]: Local vector to target is {0},[1}", localVectorToTarget3D.X,localVectorToTarget3D.Y);
3089 3092
3090 // Calculate the yaw. 3093 // Calculate the yaw.
3091 Vector3 angle = new Vector3(0, 0, (float)(Math.Atan2(localVectorToTarget2D.Y, localVectorToTarget2D.X))); 3094 Vector3 angle = new Vector3(0, 0, (float)(Math.Atan2(localVectorToTarget3D.Y, localVectorToTarget3D.X)));
3092 3095
3093// m_log.DebugFormat("[SCENE PRESENCE]: Angle is {0}", angle); 3096// m_log.DebugFormat("[SCENE PRESENCE]: Angle is {0}", angle);
3094 3097