attempt to fix sitting-related bugs #3 and #67

afrisby
Jeff Ames 2007-12-01 21:45:43 +00:00
parent 96ac8f00c7
commit 2852cd9d73
1 changed files with 17 additions and 14 deletions

View File

@ -186,6 +186,8 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_controllingClient; } get { return m_controllingClient; }
} }
protected LLVector3 m_parentPosition = new LLVector3();
public override LLVector3 AbsolutePosition public override LLVector3 AbsolutePosition
{ {
get get
@ -197,7 +199,7 @@ namespace OpenSim.Region.Environment.Scenes
m_pos.Z = m_physicsActor.Position.Z; m_pos.Z = m_physicsActor.Position.Z;
} }
return m_pos; return m_parentPosition + m_pos;
} }
set set
{ {
@ -684,10 +686,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_parentID != 0) if (m_parentID != 0)
{ {
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
if (part != null) m_parentPosition = new LLVector3();
AbsolutePosition = part.AbsolutePosition + m_requestedSitOffset +
new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight);
AddToPhysicalScene(); AddToPhysicalScene();
@ -757,10 +757,14 @@ namespace OpenSim.Region.Environment.Scenes
public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID) public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID)
{ {
// these magic numbers come mostly from experimenting with ODE, SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
// and seeing what looks right
AbsolutePosition = m_requestedSitOffset + if (part != null)
new LLVector3(m_physicsActor.Size.X/2.7f, 0f, m_physicsActor.Size.Z/1.45f); {
m_pos -= part.AbsolutePosition;
m_parentPosition = part.AbsolutePosition;
}
m_parentID = m_requestedSitTargetID; m_parentID = m_requestedSitTargetID;
Velocity = new LLVector3(0, 0, 0); Velocity = new LLVector3(0, 0, 0);
@ -977,7 +981,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="RemoteClient"></param> /// <param name="RemoteClient"></param>
public void SendTerseUpdateToClient(IClientAPI RemoteClient) public void SendTerseUpdateToClient(IClientAPI RemoteClient)
{ {
LLVector3 pos = AbsolutePosition; LLVector3 pos = m_pos;
LLVector3 vel = Velocity; LLVector3 vel = Velocity;
LLQuaternion rot; LLQuaternion rot;
rot.X = m_bodyRot.x; rot.X = m_bodyRot.x;
@ -1004,7 +1008,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (avatars[i] != this) if (avatars[i] != this)
{ {
CoarseLocations.Add(avatars[i].AbsolutePosition); CoarseLocations.Add(avatars[i].m_pos);
} }
} }
@ -1024,8 +1028,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{ {
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, AbsolutePosition, m_textureEntry.ToBytes(), LocalId, m_pos, m_textureEntry.ToBytes(), m_parentID);
m_parentID);
} }
public void SendFullUpdateToAllClients() public void SendFullUpdateToAllClients()
@ -1051,7 +1054,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SendInitialData() public void SendInitialData()
{ {
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,
AbsolutePosition, m_textureEntry.ToBytes(), m_parentID); m_pos, m_textureEntry.ToBytes(), m_parentID);
if (!m_isChildAgent) if (!m_isChildAgent)
{ {
m_scene.InformClientOfNeighbours(this); m_scene.InformClientOfNeighbours(this);