aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP
diff options
context:
space:
mode:
authorRobert Adams2013-07-22 15:41:14 -0700
committerRobert Adams2013-07-22 15:41:14 -0700
commite6b6af62dd677077664fdc8801b3a7e894a2b8da (patch)
tree850436dfaeb4519a3abf8e0445f74564208fb430 /OpenSim/Region/ClientStack/Linden/UDP
parentRevert "BulletSim: freshen up the code for constraint based linksets." (diff)
downloadopensim-SC_OLD-e6b6af62dd677077664fdc8801b3a7e894a2b8da.zip
opensim-SC_OLD-e6b6af62dd677077664fdc8801b3a7e894a2b8da.tar.gz
opensim-SC_OLD-e6b6af62dd677077664fdc8801b3a7e894a2b8da.tar.bz2
opensim-SC_OLD-e6b6af62dd677077664fdc8801b3a7e894a2b8da.tar.xz
Added check for user movement specification before discarding an incoming
AgentUpdate packet. This fixes the problem with vehicles not moving forward after the first up-arrow. Code to fix a potential exception when using different IClientAPIs.
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs81
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs3
2 files changed, 42 insertions, 42 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index e23e55b..32549c8 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -359,12 +359,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
359 /// cannot retain a reference to it outside of that method. 359 /// cannot retain a reference to it outside of that method.
360 /// </remarks> 360 /// </remarks>
361 private AgentUpdateArgs m_thisAgentUpdateArgs = new AgentUpdateArgs(); 361 private AgentUpdateArgs m_thisAgentUpdateArgs = new AgentUpdateArgs();
362 private float qdelta1;
363 private float qdelta2;
364 private float vdelta1;
365 private float vdelta2;
366 private float vdelta3;
367 private float vdelta4;
368 362
369 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 363 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
370 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 364 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
@@ -5576,7 +5570,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5576 5570
5577 #region Scene/Avatar 5571 #region Scene/Avatar
5578 5572
5573 // Threshold for body rotation to be a significant agent update
5579 private const float QDELTA = 0.000001f; 5574 private const float QDELTA = 0.000001f;
5575 // Threshold for camera rotation to be a significant agent update
5580 private const float VDELTA = 0.01f; 5576 private const float VDELTA = 0.01f;
5581 5577
5582 /// <summary> 5578 /// <summary>
@@ -5587,31 +5583,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5587 /// <param name='x'></param> 5583 /// <param name='x'></param>
5588 public bool CheckAgentUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) 5584 public bool CheckAgentUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
5589 { 5585 {
5590 // Compute these only once, when this function is called from down below 5586 return CheckAgentMovementUpdateSignificance(x) || CheckAgentCameraUpdateSignificance(x);
5591 qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2);
5592 //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2);
5593 vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
5594 vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
5595 vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
5596 vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
5597
5598 bool significant = CheckAgentMovementUpdateSignificance(x) || CheckAgentCameraUpdateSignificance(x);
5599
5600 // Emergency debugging
5601 //if (significant)
5602 //{
5603 //m_log.DebugFormat("[LLCLIENTVIEW]: Cam1 {0} {1}",
5604 // x.CameraAtAxis, x.CameraCenter);
5605 //m_log.DebugFormat("[LLCLIENTVIEW]: Cam2 {0} {1}",
5606 // x.CameraLeftAxis, x.CameraUpAxis);
5607 //m_log.DebugFormat("[LLCLIENTVIEW]: Bod {0} {1}",
5608 // qdelta1, qdelta2);
5609 //m_log.DebugFormat("[LLCLIENTVIEW]: St {0} {1} {2} {3}",
5610 // x.ControlFlags, x.Flags, x.Far, x.State);
5611 //}
5612
5613 return significant;
5614
5615 } 5587 }
5616 5588
5617 /// <summary> 5589 /// <summary>
@@ -5622,15 +5594,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5622 /// <param name='x'></param> 5594 /// <param name='x'></param>
5623 private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) 5595 private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
5624 { 5596 {
5625 return ( 5597 float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2);
5626 (qdelta1 > QDELTA) || 5598 //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2);
5599
5600 bool movementSignificant =
5601 (qdelta1 > QDELTA) // significant if body rotation above threshold
5627 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack 5602 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
5628 //(qdelta2 > QDELTA * 10) || 5603 // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold
5629 (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) || 5604 || (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
5630 (x.Far != m_thisAgentUpdateArgs.Far) || 5605 || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands
5631 (x.Flags != m_thisAgentUpdateArgs.Flags) || 5606 || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed
5632 (x.State != m_thisAgentUpdateArgs.State) 5607 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
5633 ); 5608 || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
5609 ;
5610 //if (movementSignificant)
5611 //{
5612 //m_log.DebugFormat("[LLCLIENTVIEW]: Bod {0} {1}",
5613 // qdelta1, qdelta2);
5614 //m_log.DebugFormat("[LLCLIENTVIEW]: St {0} {1} {2} {3}",
5615 // x.ControlFlags, x.Flags, x.Far, x.State);
5616 //}
5617 return movementSignificant;
5634 } 5618 }
5635 5619
5636 /// <summary> 5620 /// <summary>
@@ -5641,12 +5625,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5641 /// <param name='x'></param> 5625 /// <param name='x'></param>
5642 private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) 5626 private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
5643 { 5627 {
5644 return ( 5628 float vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
5629 float vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
5630 float vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
5631 float vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
5632
5633 bool cameraSignificant =
5645 (vdelta1 > VDELTA) || 5634 (vdelta1 > VDELTA) ||
5646 (vdelta2 > VDELTA) || 5635 (vdelta2 > VDELTA) ||
5647 (vdelta3 > VDELTA) || 5636 (vdelta3 > VDELTA) ||
5648 (vdelta4 > VDELTA) 5637 (vdelta4 > VDELTA)
5649 ); 5638 ;
5639
5640 //if (cameraSignificant)
5641 //{
5642 //m_log.DebugFormat("[LLCLIENTVIEW]: Cam1 {0} {1}",
5643 // x.CameraAtAxis, x.CameraCenter);
5644 //m_log.DebugFormat("[LLCLIENTVIEW]: Cam2 {0} {1}",
5645 // x.CameraLeftAxis, x.CameraUpAxis);
5646 //}
5647
5648 return cameraSignificant;
5650 } 5649 }
5651 5650
5652 private bool HandleAgentUpdate(IClientAPI sener, Packet packet) 5651 private bool HandleAgentUpdate(IClientAPI sener, Packet packet)
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 32282af..f5c0b05 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1316,9 +1316,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1316 1316
1317 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; 1317 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
1318 1318
1319 LLClientView llClient = client as LLClientView;
1319 if (agentUpdate.AgentData.SessionID != client.SessionId 1320 if (agentUpdate.AgentData.SessionID != client.SessionId
1320 || agentUpdate.AgentData.AgentID != client.AgentId 1321 || agentUpdate.AgentData.AgentID != client.AgentId
1321 || !((LLClientView)client).CheckAgentUpdateSignificance(agentUpdate.AgentData)) 1322 || !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) )
1322 { 1323 {
1323 PacketPool.Instance.ReturnPacket(packet); 1324 PacketPool.Instance.ReturnPacket(packet);
1324 return; 1325 return;