aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs61
1 files changed, 31 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 37ac094..cfb1be4 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1093,7 +1093,7 @@ namespace OpenSim.Region.Framework.Scenes
1093 AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = 1093 AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition =
1094 m_reprioritizationLastPosition = ControllingClient.StartPos; 1094 m_reprioritizationLastPosition = ControllingClient.StartPos;
1095 1095
1096 m_reprioritizationLastDrawDistance = DrawDistance; 1096 m_reprioritizationLastDrawDistance = -1000;
1097 1097
1098 // disable updates workjobs for now 1098 // disable updates workjobs for now
1099 m_childUpdatesBusy = true; 1099 m_childUpdatesBusy = true;
@@ -2928,21 +2928,18 @@ namespace OpenSim.Region.Framework.Scenes
2928 2928
2929 float distanceToTarget; 2929 float distanceToTarget;
2930 if(Flying && !LandAtTarget) 2930 if(Flying && !LandAtTarget)
2931 { 2931
2932 distanceToTarget = LocalVectorToTarget3D.Length(); 2932 distanceToTarget = LocalVectorToTarget3D.LengthSquared();
2933 }
2934 else 2933 else
2935 { 2934 distanceToTarget = (LocalVectorToTarget3D.X * LocalVectorToTarget3D.X) + (LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y);
2936 distanceToTarget = (float)Math.Sqrt(LocalVectorToTarget3D.X * LocalVectorToTarget3D.X + 2935
2937 LocalVectorToTarget3D.Y * LocalVectorToTarget3D.Y);
2938 }
2939 2936
2940 // m_log.DebugFormat( 2937 // m_log.DebugFormat(
2941 // "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}", 2938 // "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
2942 // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); 2939 // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
2943 2940
2944 // Check the error term of the current position in relation to the target position 2941 // Check the error term of the current position in relation to the target position
2945 if (distanceToTarget <= tolerance) 2942 if (distanceToTarget <= tolerance * tolerance)
2946 { 2943 {
2947 // We are close enough to the target 2944 // We are close enough to the target
2948 Velocity = Vector3.Zero; 2945 Velocity = Vector3.Zero;
@@ -2964,8 +2961,9 @@ namespace OpenSim.Region.Framework.Scenes
2964 return false; 2961 return false;
2965 } 2962 }
2966 2963
2967 if(m_moveToSpeed > 0 && distanceToTarget <= m_moveToSpeed * Scene.FrameTime) 2964 if (m_moveToSpeed > 0 &&
2968 m_moveToSpeed = distanceToTarget / Scene.FrameTime; 2965 distanceToTarget <= m_moveToSpeed * m_moveToSpeed * Scene.FrameTime * Scene.FrameTime)
2966 m_moveToSpeed = (float)Math.Sqrt(distanceToTarget) / Scene.FrameTime;
2969 2967
2970 try 2968 try
2971 { 2969 {
@@ -3857,14 +3855,9 @@ namespace OpenSim.Region.Framework.Scenes
3857 Vector3 vel = Velocity; 3855 Vector3 vel = Velocity;
3858 Vector3 dpos = m_pos - m_lastPosition; 3856 Vector3 dpos = m_pos - m_lastPosition;
3859 if( State != m_lastState || 3857 if( State != m_lastState ||
3860 Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || 3858 !vel.ApproxEquals(m_lastVelocity) ||
3861 Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || 3859 !m_bodyRot.ApproxEquals(m_lastRotation) ||
3862 Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || 3860
3863
3864 Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE ||
3865 Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE ||
3866 Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE ||
3867
3868 (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) || 3861 (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) ||
3869 3862
3870 Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || 3863 Math.Abs(dpos.X) > POSITION_LARGETOLERANCE ||
@@ -4028,18 +4021,22 @@ namespace OpenSim.Region.Framework.Scenes
4028 { 4021 {
4029 landch.sendClientInitialLandInfo(ControllingClient); 4022 landch.sendClientInitialLandInfo(ControllingClient);
4030 } 4023 }
4031 m_reprioritizationLastPosition = AbsolutePosition;
4032 m_reprioritizationLastDrawDistance = DrawDistance;
4033 m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it
4034 } 4024 }
4035 else 4025
4026 SendOtherAgentsAvatarFullToMe();
4027
4028 if(m_scene.ObjectsCullingByDistance)
4036 { 4029 {
4030 m_reprioritizationBusy = true;
4037 m_reprioritizationLastPosition = AbsolutePosition; 4031 m_reprioritizationLastPosition = AbsolutePosition;
4038 m_reprioritizationLastDrawDistance = -1000; 4032 m_reprioritizationLastDrawDistance = DrawDistance;
4039 m_reprioritizationLastTime = Util.EnvironmentTickCount() + 2000; // delay it 4033
4034 ControllingClient.ReprioritizeUpdates();
4035 m_reprioritizationLastTime = Util.EnvironmentTickCount();
4036 m_reprioritizationBusy = false;
4037 return;
4040 } 4038 }
4041 4039
4042 SendOtherAgentsAvatarFullToMe();
4043 EntityBase[] entities = Scene.Entities.GetEntities(); 4040 EntityBase[] entities = Scene.Entities.GetEntities();
4044 foreach (EntityBase e in entities) 4041 foreach (EntityBase e in entities)
4045 { 4042 {
@@ -4047,6 +4044,10 @@ namespace OpenSim.Region.Framework.Scenes
4047 ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient); 4044 ((SceneObjectGroup)e).SendFullAnimUpdateToClient(ControllingClient);
4048 } 4045 }
4049 4046
4047 m_reprioritizationLastPosition = AbsolutePosition;
4048 m_reprioritizationLastDrawDistance = DrawDistance;
4049 m_reprioritizationLastTime = Util.EnvironmentTickCount() + 15000; // delay it
4050
4050 m_reprioritizationBusy = false; 4051 m_reprioritizationBusy = false;
4051 4052
4052 }); 4053 });
@@ -4268,9 +4269,9 @@ namespace OpenSim.Region.Framework.Scenes
4268 bool byDrawdistance = Scene.ObjectsCullingByDistance; 4269 bool byDrawdistance = Scene.ObjectsCullingByDistance;
4269 if(byDrawdistance) 4270 if(byDrawdistance)
4270 { 4271 {
4271 float minregionSize = (float)Scene.RegionInfo.RegionSizeX; 4272 float minregionSize = Scene.RegionInfo.RegionSizeX;
4272 if(minregionSize > (float)Scene.RegionInfo.RegionSizeY) 4273 if(minregionSize > Scene.RegionInfo.RegionSizeY)
4273 minregionSize = (float)Scene.RegionInfo.RegionSizeY; 4274 minregionSize = Scene.RegionInfo.RegionSizeY;
4274 minregionSize *= 0.5f; 4275 minregionSize *= 0.5f;
4275 if(DrawDistance > minregionSize && m_reprioritizationLastDrawDistance > minregionSize) 4276 if(DrawDistance > minregionSize && m_reprioritizationLastDrawDistance > minregionSize)
4276 byDrawdistance = false; 4277 byDrawdistance = false;
@@ -5945,7 +5946,7 @@ namespace OpenSim.Region.Framework.Scenes
5945 5946
5946 // returns true it local teleport allowed and sets the destiny position into pos 5947 // returns true it local teleport allowed and sets the destiny position into pos
5947 5948
5948 private bool CheckLocalTPLandingPoint(ref Vector3 pos) 5949 public bool CheckLocalTPLandingPoint(ref Vector3 pos)
5949 { 5950 {
5950 // Never constrain lures 5951 // Never constrain lures
5951 if ((TeleportFlags & TeleportFlags.ViaLure) != 0) 5952 if ((TeleportFlags & TeleportFlags.ViaLure) != 0)