aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-10-14 20:28:34 +0000
committerJustin Clarke Casey2008-10-14 20:28:34 +0000
commitb70a28537350908e8cbf5fe254315fa760a2ee4e (patch)
tree56cf427a81232a406a86dcf8086bae3485b9075a
parentmove from index based to exists strategy here (diff)
downloadopensim-SC-b70a28537350908e8cbf5fe254315fa760a2ee4e.zip
opensim-SC-b70a28537350908e8cbf5fe254315fa760a2ee4e.tar.gz
opensim-SC-b70a28537350908e8cbf5fe254315fa760a2ee4e.tar.bz2
opensim-SC-b70a28537350908e8cbf5fe254315fa760a2ee4e.tar.xz
* Send an avatar update to other clients when an avatar rotates, as well as when it moves
* This should fix a long standing issue where you often wouldn't see other people simply turn around without moving at all * Arguably lastPhysRot (to mirror lastPhysPos) is not a good name, may change variable names later
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs24
2 files changed, 25 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 476b3d5..6a011b4 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -2339,7 +2339,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2339 } 2339 }
2340 2340
2341 /// <summary> 2341 /// <summary>
2342 /// 2342 /// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of
2343 /// the client itself.
2343 /// </summary> 2344 /// </summary>
2344 /// <param name="regionHandle"></param> 2345 /// <param name="regionHandle"></param>
2345 /// <param name="timeDilation"></param> 2346 /// <param name="timeDilation"></param>
@@ -2352,6 +2353,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
2352 if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) 2353 if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
2353 rotation = Quaternion.Identity; 2354 rotation = Quaternion.Identity;
2354 2355
2356 //m_log.DebugFormat("[CLIENT]: Sending rotation {0} for {1} to {2}", rotation, localID, Name);
2357
2355 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = 2358 ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
2356 CreateAvatarImprovedBlock(localID, position, velocity, rotation); 2359 CreateAvatarImprovedBlock(localID, position, velocity, rotation);
2357 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); 2360 ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 981b15c..d87a7e2 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -142,7 +142,16 @@ namespace OpenSim.Region.Environment.Scenes
142 protected ulong crossingFromRegion = 0; 142 protected ulong crossingFromRegion = 0;
143 143
144 private readonly Vector3[] Dir_Vectors = new Vector3[6]; 144 private readonly Vector3[] Dir_Vectors = new Vector3[6];
145
146 /// <value>
147 /// The avatar position last sent to clients
148 /// </value>
145 private Vector3 lastPhysPos = Vector3.Zero; 149 private Vector3 lastPhysPos = Vector3.Zero;
150
151 /// <value>
152 /// The avatar body rotation last sent to clients
153 /// </value>
154 private Quaternion lastPhysRot = Quaternion.Identity;
146 155
147 // Position of agent's camera in world (region cordinates) 156 // Position of agent's camera in world (region cordinates)
148 protected Vector3 m_CameraCenter = Vector3.Zero; 157 protected Vector3 m_CameraCenter = Vector3.Zero;
@@ -1581,7 +1590,9 @@ namespace OpenSim.Region.Environment.Scenes
1581 m_updateCount = 0; 1590 m_updateCount = 0;
1582 } 1591 }
1583 } 1592 }
1584 else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement 1593 else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02)
1594 || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)
1595 || lastPhysRot != m_bodyRot)
1585 { 1596 {
1586 // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity 1597 // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
1587 // doing the above assures us that we know what we sent the clients last 1598 // doing the above assures us that we know what we sent the clients last
@@ -1628,6 +1639,7 @@ namespace OpenSim.Region.Environment.Scenes
1628 1639
1629 m_lastVelocity = m_velocity; 1640 m_lastVelocity = m_velocity;
1630 lastPhysPos = AbsolutePosition; 1641 lastPhysPos = AbsolutePosition;
1642 lastPhysRot = m_bodyRot;
1631 1643
1632 m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); 1644 m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
1633 1645
@@ -2540,7 +2552,10 @@ namespace OpenSim.Region.Environment.Scenes
2540 (float)info.GetValue("lastPhysPos.X", typeof(float)), 2552 (float)info.GetValue("lastPhysPos.X", typeof(float)),
2541 (float)info.GetValue("lastPhysPos.Y", typeof(float)), 2553 (float)info.GetValue("lastPhysPos.Y", typeof(float)),
2542 (float)info.GetValue("lastPhysPos.Z", typeof(float))); 2554 (float)info.GetValue("lastPhysPos.Z", typeof(float)));
2543 2555
2556 // Possibly we should store lastPhysRot. But there may well be not much point since rotation changes
2557 // wouldn't carry us across borders anyway
2558
2544 m_CameraCenter 2559 m_CameraCenter
2545 = new Vector3( 2560 = new Vector3(
2546 (float)info.GetValue("m_CameraCenter.X", typeof(float)), 2561 (float)info.GetValue("m_CameraCenter.X", typeof(float)),
@@ -2686,7 +2701,10 @@ namespace OpenSim.Region.Environment.Scenes
2686 // Vector3 2701 // Vector3
2687 info.AddValue("lastPhysPos.X", lastPhysPos.X); 2702 info.AddValue("lastPhysPos.X", lastPhysPos.X);
2688 info.AddValue("lastPhysPos.Y", lastPhysPos.Y); 2703 info.AddValue("lastPhysPos.Y", lastPhysPos.Y);
2689 info.AddValue("lastPhysPos.Z", lastPhysPos.Z); 2704 info.AddValue("lastPhysPos.Z", lastPhysPos.Z);
2705
2706 // Possibly we should retrieve lastPhysRot. But there may well be not much point since rotation changes
2707 // wouldn't carry us across borders anyway
2690 2708
2691 // Vector3 2709 // Vector3
2692 info.AddValue("m_CameraCenter.X", m_CameraCenter.X); 2710 info.AddValue("m_CameraCenter.X", m_CameraCenter.X);