improve object crossings
parent
207dd6da48
commit
bd11311845
|
@ -2174,16 +2174,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// The first region is the home region of the passed scene presence.
|
// The first region is the home region of the passed scene presence.
|
||||||
Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
|
Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
|
||||||
{
|
{
|
||||||
/*
|
return new Vector3(sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
|
||||||
int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX;
|
|
||||||
int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY;
|
|
||||||
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);
|
|
||||||
*/
|
|
||||||
return new Vector3(sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
|
|
||||||
sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
|
sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
|
||||||
0f);
|
0f);
|
||||||
}
|
}
|
||||||
|
@ -2543,28 +2534,20 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (scene == null)
|
if (scene == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
RegionInfo srcRegionInfo = scene.RegionInfo;
|
int x = (int)targetPosition.X + (int)scene.RegionInfo.WorldLocX;
|
||||||
int neighbourx = (int)srcRegionInfo.RegionLocX;
|
if (targetPosition.X >= 0)
|
||||||
int neighboury = (int)srcRegionInfo.RegionLocY;
|
x++;
|
||||||
float regionSizeX = srcRegionInfo.RegionSizeX;
|
else
|
||||||
float regionSizeY = srcRegionInfo.RegionSizeY;
|
x--;
|
||||||
|
|
||||||
float edgeJitter = 0.2f;
|
int y = (int)targetPosition.Y + (int)scene.RegionInfo.WorldLocY;
|
||||||
|
if (targetPosition.Y >= 0)
|
||||||
|
y++;
|
||||||
|
else
|
||||||
|
y--;
|
||||||
|
|
||||||
if (targetPosition.X < edgeJitter)
|
|
||||||
neighbourx--;
|
|
||||||
else if (targetPosition.X > regionSizeX - edgeJitter)
|
|
||||||
neighbourx += (int)(regionSizeX / Constants.RegionSize);
|
|
||||||
|
|
||||||
if (targetPosition.Y < edgeJitter)
|
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID,x,y);
|
||||||
neighboury--;
|
|
||||||
else if (targetPosition.Y > regionSizeY - edgeJitter)
|
|
||||||
neighboury += (int)(regionSizeY / Constants.RegionSize);
|
|
||||||
|
|
||||||
int x = neighbourx * (int)Constants.RegionSize;
|
|
||||||
int y = neighboury * (int)Constants.RegionSize;
|
|
||||||
|
|
||||||
GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
|
|
||||||
if (neighbourRegion == null)
|
if (neighbourRegion == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -2577,15 +2560,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
if (newRegionSizeY == 0)
|
if (newRegionSizeY == 0)
|
||||||
newRegionSizeY = Constants.RegionSize;
|
newRegionSizeY = Constants.RegionSize;
|
||||||
|
|
||||||
if (targetPosition.X < edgeJitter)
|
|
||||||
newpos.X += newRegionSizeX;
|
|
||||||
else if (targetPosition.X > regionSizeX - edgeJitter)
|
|
||||||
newpos.X -= regionSizeX;
|
|
||||||
|
|
||||||
if (targetPosition.Y < edgeJitter)
|
newpos.X = targetPosition.X - (neighbourRegion.RegionLocX - (int)scene.RegionInfo.WorldLocX);
|
||||||
newpos.Y += newRegionSizeY;
|
newpos.Y = targetPosition.Y - (neighbourRegion.RegionLocY - (int)scene.RegionInfo.WorldLocY);
|
||||||
else if (targetPosition.Y > regionSizeY - edgeJitter)
|
|
||||||
newpos.Y -= regionSizeY;
|
|
||||||
|
|
||||||
const float enterDistance = 0.2f;
|
const float enterDistance = 0.2f;
|
||||||
newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance);
|
newpos.X = Util.Clamp(newpos.X, enterDistance, newRegionSizeX - enterDistance);
|
||||||
|
|
Loading…
Reference in New Issue