* Applying issue#230 - Avatar stuck at region edge (Thanks Babblefrog!)

* Fix for issue #237 - Sim startup cannot read a terrain file (Reported by CutterRubio)
afrisby
Adam Frisby 2007-07-29 06:23:07 +00:00
parent 0f90cdfed1
commit c33b29a105
2 changed files with 29 additions and 35 deletions

View File

@ -99,49 +99,43 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{ {
foreach (BasicActor actor in _actors) foreach (BasicActor actor in _actors)
{ {
if ((actor.Position.Y > 0 && actor.Position.Y < 256) && (actor.Position.X > 0 && actor.Position.X < 256)) float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;
{ actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep);
float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
actor.Position.X = actor.Position.X + (actor.Velocity.X * timeStep); if (actor.Flying)
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
if (actor.Flying)
{ {
if (actor.Position.Z + (actor.Velocity.Z * timeStep) < if (actor.Position.Z + (actor.Velocity.Z * timeStep) < _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
_heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 2)
{
actor.Position.Z = height;
actor.Velocity.Z = 0;
}
else
{
actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
}
}
else
{ {
actor.Position.Z = height; actor.Position.Z = height;
actor.Velocity.Z = 0; actor.Velocity.Z = 0;
} }
else
{
actor.Position.Z = actor.Position.Z + (actor.Velocity.Z * timeStep);
}
} }
else else
{ {
if (actor.Position.Y < 0) actor.Position.Z = height;
{ actor.Velocity.Z = 0;
actor.Position.Y = 0; }
}
else if (actor.Position.Y > 256)
{
actor.Position.Y = 256;
}
if (actor.Position.X < 0) if (actor.Position.Y < 0)
{ {
actor.Position.X = 0; actor.Position.Y = 0;
} }
if (actor.Position.X > 256) else if (actor.Position.Y > 256)
{ {
actor.Position.X = 256; actor.Position.Y = 256;
} }
if (actor.Position.X < 0)
{
actor.Position.X = 0;
}
if (actor.Position.X > 256)
{
actor.Position.X = 256;
} }
} }
} }

View File

@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Terrain
for (int y = 0; y < copy.h; y++) for (int y = 0; y < copy.h; y++)
{ {
// 512 is the largest possible height before colours clamp // 512 is the largest possible height before colours clamp
int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(copy.h - y, x) / 512.0), 0.0) * pallete); int colorindex = (int)(Math.Max(Math.Min(1.0, copy.Get(copy.h - y, x) / 512.0), 0.0) * (pallete - 1));
bmp.SetPixel(x, y, colours[colorindex]); bmp.SetPixel(x, y, colours[colorindex]);
} }
} }