Index: OpenMetaverse/AgentManager.cs =================================================================== --- OpenMetaverse/AgentManager.cs (revision 3386) +++ OpenMetaverse/AgentManager.cs (working copy) @@ -1250,27 +1250,20 @@ Vector3 fullPosition = relativePosition; Client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(sittingOn, out p); - // go up the hiearchy trying to find the root prim - while (p != null && p.ParentID != 0) + if (p != null) { - Avatar av; - if (Client.Network.CurrentSim.ObjectsAvatars.TryGetValue(p.ParentID, out av)) + if (p.ParentID != 0) { - p = av; - fullPosition += p.Position; - } - else - { - if (Client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(p.ParentID, out p)) + Primitive rootPrim; + Client.Network.CurrentSim.ObjectsPrimitives.TryGetValue(p.ParentID, out rootPrim); + + if (rootPrim != null) { - fullPosition += p.Position; + return (rootPrim.Position + relativePosition); } } - } - if (p != null) // we found the root prim - { - return fullPosition; + return (p.Position + relativePosition); } // Didn't find the seat's root prim, try returning coarse loaction