Changed it so the avatar's rotation is now sent as part of a full avatar update.

This should fix the wrong rotation on existing sitting avatar when logging in bug.
0.6.0-stable
MW 2008-07-23 11:07:59 +00:00
parent ce4bcb5065
commit 9b51bb545e
5 changed files with 34 additions and 8 deletions

View File

@ -545,7 +545,7 @@ namespace OpenSim.Framework
void SendPayPrice(LLUUID objectID, int[] payPrice); void SendPayPrice(LLUUID objectID, int[] payPrice);
void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID,
LLVector3 Pos, byte[] textureEntry, uint parentID); LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLVector3 velocity, LLQuaternion rotation); LLVector3 velocity, LLQuaternion rotation);

View File

@ -2132,7 +2132,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="avatarLocalID"></param> /// <param name="avatarLocalID"></param>
/// <param name="Pos"></param> /// <param name="Pos"></param>
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation)
{ {
ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
@ -2147,9 +2147,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
objupdate.ObjectData[0].ParentID = parentID; objupdate.ObjectData[0].ParentID = parentID;
objupdate.ObjectData[0].NameValue = objupdate.ObjectData[0].NameValue =
Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName);
LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
byte[] pb = pos2.GetBytes(); byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
byte[] rot = rotation.GetBytes();
Array.Copy(rot, 0, objupdate.ObjectData[0].ObjectData, 52, rot.Length);
objupdate.Header.Zerocoded = true; objupdate.Header.Zerocoded = true;
OutPacket(objupdate, ThrottleOutPacketType.Task); OutPacket(objupdate, ThrottleOutPacketType.Task);
} }

View File

@ -496,7 +496,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
} }
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation)
{ {
} }

View File

@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes
private bool m_setAlwaysRun = false; private bool m_setAlwaysRun = false;
private Quaternion m_bodyRot; private Quaternion m_bodyRot= Quaternion.Identity;
public bool IsRestrictedToRegion = false; public bool IsRestrictedToRegion = false;
@ -1266,7 +1266,8 @@ namespace OpenSim.Region.Environment.Scenes
SendFullUpdateToAllClients(); SendFullUpdateToAllClients();
// This may seem stupid, but Our Full updates don't send avatar rotation :P // This may seem stupid, but Our Full updates don't send avatar rotation :P
// So we're also sending a terse update (which has avatar rotation) // So we're also sending a terse update (which has avatar rotation)
SendTerseUpdateToAllClients(); // [Update] We do now.
//SendTerseUpdateToAllClients();
} }
/// <summary> /// <summary>
@ -1617,9 +1618,19 @@ namespace OpenSim.Region.Environment.Scenes
if (m_appearance.Texture == null) if (m_appearance.Texture == null)
return; return;
LLQuaternion rot;
if (m_bodyRot != null)
{
rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w);
}
else
{
rot = LLQuaternion.Identity;
}
remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
LocalId, m_pos, m_appearance.Texture.ToBytes(), LocalId, m_pos, m_appearance.Texture.ToBytes(),
m_parentID); m_parentID, rot);
m_scene.AddAgentUpdates(1); m_scene.AddAgentUpdates(1);
} }
@ -1671,8 +1682,18 @@ namespace OpenSim.Region.Environment.Scenes
// Needed for standalone // Needed for standalone
m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
LLQuaternion rot;
if (m_bodyRot != null)
{
rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w);
}
else
{
rot = LLQuaternion.Identity;
}
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId,
m_pos, m_appearance.Texture.ToBytes(), m_parentID); m_pos, m_appearance.Texture.ToBytes(), m_parentID, rot);
if (!m_isChildAgent) if (!m_isChildAgent)
{ {

View File

@ -413,7 +413,7 @@ namespace OpenSim.Region.Examples.SimpleModule
} }
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID,
uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation)
{ {
} }