diff options
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.
5 files changed, 34 insertions, 8 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index b1f62f1..a97ce5e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -545,7 +545,7 @@ namespace OpenSim.Framework | |||
545 | void SendPayPrice(LLUUID objectID, int[] payPrice); | 545 | void SendPayPrice(LLUUID objectID, int[] payPrice); |
546 | 546 | ||
547 | void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, | 547 | void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, uint avatarLocalID, |
548 | LLVector3 Pos, byte[] textureEntry, uint parentID); | 548 | LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation); |
549 | 549 | ||
550 | void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, | 550 | void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, |
551 | LLVector3 velocity, LLQuaternion rotation); | 551 | LLVector3 velocity, LLQuaternion rotation); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 41ac657..3fa26e4 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -2132,7 +2132,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2132 | /// <param name="avatarLocalID"></param> | 2132 | /// <param name="avatarLocalID"></param> |
2133 | /// <param name="Pos"></param> | 2133 | /// <param name="Pos"></param> |
2134 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, | 2134 | public void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
2135 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 2135 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation) |
2136 | { | 2136 | { |
2137 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 2137 | ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
2138 | // TODO: don't create new blocks if recycling an old packet | 2138 | // TODO: don't create new blocks if recycling an old packet |
@@ -2147,9 +2147,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2147 | objupdate.ObjectData[0].ParentID = parentID; | 2147 | objupdate.ObjectData[0].ParentID = parentID; |
2148 | objupdate.ObjectData[0].NameValue = | 2148 | objupdate.ObjectData[0].NameValue = |
2149 | Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); | 2149 | Helpers.StringToField("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName); |
2150 | |||
2150 | LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); | 2151 | LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z); |
2151 | byte[] pb = pos2.GetBytes(); | 2152 | byte[] pb = pos2.GetBytes(); |
2152 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | 2153 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); |
2154 | |||
2155 | byte[] rot = rotation.GetBytes(); | ||
2156 | Array.Copy(rot, 0, objupdate.ObjectData[0].ObjectData, 52, rot.Length); | ||
2157 | |||
2153 | objupdate.Header.Zerocoded = true; | 2158 | objupdate.Header.Zerocoded = true; |
2154 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 2159 | OutPacket(objupdate, ThrottleOutPacketType.Task); |
2155 | } | 2160 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 72520c4..4b42f9e 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -496,7 +496,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
496 | } | 496 | } |
497 | 497 | ||
498 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, | 498 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
499 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 499 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation) |
500 | { | 500 | { |
501 | } | 501 | } |
502 | 502 | ||
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 39718dc..2434180 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
118 | 118 | ||
119 | private bool m_setAlwaysRun = false; | 119 | private bool m_setAlwaysRun = false; |
120 | 120 | ||
121 | private Quaternion m_bodyRot; | 121 | private Quaternion m_bodyRot= Quaternion.Identity; |
122 | 122 | ||
123 | public bool IsRestrictedToRegion = false; | 123 | public bool IsRestrictedToRegion = false; |
124 | 124 | ||
@@ -1266,7 +1266,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1266 | SendFullUpdateToAllClients(); | 1266 | SendFullUpdateToAllClients(); |
1267 | // This may seem stupid, but Our Full updates don't send avatar rotation :P | 1267 | // This may seem stupid, but Our Full updates don't send avatar rotation :P |
1268 | // So we're also sending a terse update (which has avatar rotation) | 1268 | // So we're also sending a terse update (which has avatar rotation) |
1269 | SendTerseUpdateToAllClients(); | 1269 | // [Update] We do now. |
1270 | //SendTerseUpdateToAllClients(); | ||
1270 | } | 1271 | } |
1271 | 1272 | ||
1272 | /// <summary> | 1273 | /// <summary> |
@@ -1617,9 +1618,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
1617 | if (m_appearance.Texture == null) | 1618 | if (m_appearance.Texture == null) |
1618 | return; | 1619 | return; |
1619 | 1620 | ||
1621 | LLQuaternion rot; | ||
1622 | if (m_bodyRot != null) | ||
1623 | { | ||
1624 | rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); | ||
1625 | } | ||
1626 | else | ||
1627 | { | ||
1628 | rot = LLQuaternion.Identity; | ||
1629 | } | ||
1630 | |||
1620 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | 1631 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, |
1621 | LocalId, m_pos, m_appearance.Texture.ToBytes(), | 1632 | LocalId, m_pos, m_appearance.Texture.ToBytes(), |
1622 | m_parentID); | 1633 | m_parentID, rot); |
1623 | m_scene.AddAgentUpdates(1); | 1634 | m_scene.AddAgentUpdates(1); |
1624 | } | 1635 | } |
1625 | 1636 | ||
@@ -1671,8 +1682,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1671 | // Needed for standalone | 1682 | // Needed for standalone |
1672 | m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | 1683 | m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); |
1673 | 1684 | ||
1685 | LLQuaternion rot; | ||
1686 | if (m_bodyRot != null) | ||
1687 | { | ||
1688 | rot = new LLQuaternion(m_bodyRot.x, m_bodyRot.y, m_bodyRot.z, m_bodyRot.w); | ||
1689 | } | ||
1690 | else | ||
1691 | { | ||
1692 | rot = LLQuaternion.Identity; | ||
1693 | } | ||
1694 | |||
1674 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, | 1695 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, |
1675 | m_pos, m_appearance.Texture.ToBytes(), m_parentID); | 1696 | m_pos, m_appearance.Texture.ToBytes(), m_parentID, rot); |
1676 | 1697 | ||
1677 | if (!m_isChildAgent) | 1698 | if (!m_isChildAgent) |
1678 | { | 1699 | { |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index bc675ff..22feab6 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -413,7 +413,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
413 | } | 413 | } |
414 | 414 | ||
415 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, | 415 | public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, LLUUID avatarID, |
416 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID) | 416 | uint avatarLocalID, LLVector3 Pos, byte[] textureEntry, uint parentID, LLQuaternion rotation) |
417 | { | 417 | { |
418 | } | 418 | } |
419 | 419 | ||