diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 2f947fd1ab..87f292c102 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1213,7 +1213,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; - agent.startpos = new Vector3(128, 128, 70); + agent.startpos = sp.AbsolutePosition + CalculateOffset(sp, neighbour); agent.child = true; agent.Appearance = sp.Appearance; if (currentAgentCircuit != null) @@ -1305,6 +1305,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour) + { + int rRegionX = (int)sp.Scene.RegionInfo.RegionLocX; + int rRegionY = (int)sp.Scene.RegionInfo.RegionLocY; + int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize; + int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize; + int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize; + int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize; + return new Vector3(shiftx, shifty, 0f); + } + private void InformClientOfNeighbourCompleted(IAsyncResult iar) { InformClientOfNeighbourDelegate icon = (InformClientOfNeighbourDelegate)iar.AsyncState;