diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index fc1d738..46079bb 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -186,6 +186,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
186 | get { return m_controllingClient; } | 186 | get { return m_controllingClient; } |
187 | } | 187 | } |
188 | 188 | ||
189 | protected LLVector3 m_parentPosition = new LLVector3(); | ||
190 | |||
189 | public override LLVector3 AbsolutePosition | 191 | public override LLVector3 AbsolutePosition |
190 | { | 192 | { |
191 | get | 193 | get |
@@ -197,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
197 | m_pos.Z = m_physicsActor.Position.Z; | 199 | m_pos.Z = m_physicsActor.Position.Z; |
198 | } | 200 | } |
199 | 201 | ||
200 | return m_pos; | 202 | return m_parentPosition + m_pos; |
201 | } | 203 | } |
202 | set | 204 | set |
203 | { | 205 | { |
@@ -684,10 +686,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
684 | { | 686 | { |
685 | if (m_parentID != 0) | 687 | if (m_parentID != 0) |
686 | { | 688 | { |
687 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 689 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); |
688 | if (part != null) | 690 | m_parentPosition = new LLVector3(); |
689 | AbsolutePosition = part.AbsolutePosition + m_requestedSitOffset + | ||
690 | new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | ||
691 | 691 | ||
692 | AddToPhysicalScene(); | 692 | AddToPhysicalScene(); |
693 | 693 | ||
@@ -757,10 +757,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
757 | 757 | ||
758 | public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID) | 758 | public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID) |
759 | { | 759 | { |
760 | // these magic numbers come mostly from experimenting with ODE, | 760 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); |
761 | // and seeing what looks right | 761 | |
762 | AbsolutePosition = m_requestedSitOffset + | 762 | if (part != null) |
763 | new LLVector3(m_physicsActor.Size.X/2.7f, 0f, m_physicsActor.Size.Z/1.45f); | 763 | { |
764 | m_pos -= part.AbsolutePosition; | ||
765 | m_parentPosition = part.AbsolutePosition; | ||
766 | } | ||
767 | |||
764 | m_parentID = m_requestedSitTargetID; | 768 | m_parentID = m_requestedSitTargetID; |
765 | 769 | ||
766 | Velocity = new LLVector3(0, 0, 0); | 770 | Velocity = new LLVector3(0, 0, 0); |
@@ -977,7 +981,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
977 | /// <param name="RemoteClient"></param> | 981 | /// <param name="RemoteClient"></param> |
978 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) | 982 | public void SendTerseUpdateToClient(IClientAPI RemoteClient) |
979 | { | 983 | { |
980 | LLVector3 pos = AbsolutePosition; | 984 | LLVector3 pos = m_pos; |
981 | LLVector3 vel = Velocity; | 985 | LLVector3 vel = Velocity; |
982 | LLQuaternion rot; | 986 | LLQuaternion rot; |
983 | rot.X = m_bodyRot.x; | 987 | rot.X = m_bodyRot.x; |
@@ -1004,7 +1008,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1004 | { | 1008 | { |
1005 | if (avatars[i] != this) | 1009 | if (avatars[i] != this) |
1006 | { | 1010 | { |
1007 | CoarseLocations.Add(avatars[i].AbsolutePosition); | 1011 | CoarseLocations.Add(avatars[i].m_pos); |
1008 | } | 1012 | } |
1009 | } | 1013 | } |
1010 | 1014 | ||
@@ -1024,8 +1028,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1024 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 1028 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
1025 | { | 1029 | { |
1026 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | 1030 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, |
1027 | LocalId, AbsolutePosition, m_textureEntry.ToBytes(), | 1031 | LocalId, m_pos, m_textureEntry.ToBytes(), m_parentID); |
1028 | m_parentID); | ||
1029 | } | 1032 | } |
1030 | 1033 | ||
1031 | public void SendFullUpdateToAllClients() | 1034 | public void SendFullUpdateToAllClients() |
@@ -1051,7 +1054,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1051 | public void SendInitialData() | 1054 | public void SendInitialData() |
1052 | { | 1055 | { |
1053 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, | 1056 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, |
1054 | AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); | 1057 | m_pos, m_textureEntry.ToBytes(), m_parentID); |
1055 | if (!m_isChildAgent) | 1058 | if (!m_isChildAgent) |
1056 | { | 1059 | { |
1057 | m_scene.InformClientOfNeighbours(this); | 1060 | m_scene.InformClientOfNeighbours(this); |