* 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 later0.6.0-stable
parent
7d6426f156
commit
b70a285373
|
@ -2339,7 +2339,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of
|
||||||
|
/// the client itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionHandle"></param>
|
/// <param name="regionHandle"></param>
|
||||||
/// <param name="timeDilation"></param>
|
/// <param name="timeDilation"></param>
|
||||||
|
@ -2352,6 +2353,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
|
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
|
||||||
rotation = Quaternion.Identity;
|
rotation = Quaternion.Identity;
|
||||||
|
|
||||||
|
//m_log.DebugFormat("[CLIENT]: Sending rotation {0} for {1} to {2}", rotation, localID, Name);
|
||||||
|
|
||||||
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
|
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
|
||||||
CreateAvatarImprovedBlock(localID, position, velocity, rotation);
|
CreateAvatarImprovedBlock(localID, position, velocity, rotation);
|
||||||
ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
|
ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
|
||||||
|
|
|
@ -142,8 +142,17 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
protected ulong crossingFromRegion = 0;
|
protected ulong crossingFromRegion = 0;
|
||||||
|
|
||||||
private readonly Vector3[] Dir_Vectors = new Vector3[6];
|
private readonly Vector3[] Dir_Vectors = new Vector3[6];
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// The avatar position last sent to clients
|
||||||
|
/// </value>
|
||||||
private Vector3 lastPhysPos = Vector3.Zero;
|
private Vector3 lastPhysPos = Vector3.Zero;
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// The avatar body rotation last sent to clients
|
||||||
|
/// </value>
|
||||||
|
private Quaternion lastPhysRot = Quaternion.Identity;
|
||||||
|
|
||||||
// Position of agent's camera in world (region cordinates)
|
// Position of agent's camera in world (region cordinates)
|
||||||
protected Vector3 m_CameraCenter = Vector3.Zero;
|
protected Vector3 m_CameraCenter = Vector3.Zero;
|
||||||
|
|
||||||
|
@ -1581,7 +1590,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_updateCount = 0;
|
m_updateCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement
|
else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02)
|
||||||
|
|| (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)
|
||||||
|
|| lastPhysRot != m_bodyRot)
|
||||||
{
|
{
|
||||||
// Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
|
// Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
|
||||||
// doing the above assures us that we know what we sent the clients last
|
// doing the above assures us that we know what we sent the clients last
|
||||||
|
@ -1628,6 +1639,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
m_lastVelocity = m_velocity;
|
m_lastVelocity = m_velocity;
|
||||||
lastPhysPos = AbsolutePosition;
|
lastPhysPos = AbsolutePosition;
|
||||||
|
lastPhysRot = m_bodyRot;
|
||||||
|
|
||||||
m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
|
m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
|
||||||
|
|
||||||
|
@ -2541,6 +2553,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
(float)info.GetValue("lastPhysPos.Y", typeof(float)),
|
(float)info.GetValue("lastPhysPos.Y", typeof(float)),
|
||||||
(float)info.GetValue("lastPhysPos.Z", typeof(float)));
|
(float)info.GetValue("lastPhysPos.Z", typeof(float)));
|
||||||
|
|
||||||
|
// Possibly we should store lastPhysRot. But there may well be not much point since rotation changes
|
||||||
|
// wouldn't carry us across borders anyway
|
||||||
|
|
||||||
m_CameraCenter
|
m_CameraCenter
|
||||||
= new Vector3(
|
= new Vector3(
|
||||||
(float)info.GetValue("m_CameraCenter.X", typeof(float)),
|
(float)info.GetValue("m_CameraCenter.X", typeof(float)),
|
||||||
|
@ -2688,6 +2703,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
info.AddValue("lastPhysPos.Y", lastPhysPos.Y);
|
info.AddValue("lastPhysPos.Y", lastPhysPos.Y);
|
||||||
info.AddValue("lastPhysPos.Z", lastPhysPos.Z);
|
info.AddValue("lastPhysPos.Z", lastPhysPos.Z);
|
||||||
|
|
||||||
|
// Possibly we should retrieve lastPhysRot. But there may well be not much point since rotation changes
|
||||||
|
// wouldn't carry us across borders anyway
|
||||||
|
|
||||||
// Vector3
|
// Vector3
|
||||||
info.AddValue("m_CameraCenter.X", m_CameraCenter.X);
|
info.AddValue("m_CameraCenter.X", m_CameraCenter.X);
|
||||||
info.AddValue("m_CameraCenter.Y", m_CameraCenter.Y);
|
info.AddValue("m_CameraCenter.Y", m_CameraCenter.Y);
|
||||||
|
|
Loading…
Reference in New Issue