OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs, OpenSim/Region/Environment/Scenes/ScenePresence.cs

Fix for array out-of-bounds error in basicphysics.
afrisby
Brian McBee 2007-08-03 21:54:21 +00:00
parent 6dabab5ef0
commit 6cb3833021
2 changed files with 14 additions and 14 deletions

View File

@ -550,7 +550,7 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 pos2 = this.Pos; LLVector3 pos2 = this.Pos;
LLVector3 vel = this.Velocity; LLVector3 vel = this.Velocity;
float timeStep = 0.2f; float timeStep = 0.1f;
pos2.X = pos2.X + (vel.X * timeStep); pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y * timeStep); pos2.Y = pos2.Y + (vel.Y * timeStep);
pos2.Z = pos2.Z + (vel.Z * timeStep); pos2.Z = pos2.Z + (vel.Z * timeStep);
@ -576,25 +576,25 @@ namespace OpenSim.Region.Environment.Scenes
uint neighbourx = this.m_regionInfo.RegionLocX; uint neighbourx = this.m_regionInfo.RegionLocX;
uint neighboury = this.m_regionInfo.RegionLocY; uint neighboury = this.m_regionInfo.RegionLocY;
if (pos.X < 3) if (pos.X < 1)
{ {
neighbourx -= 1; neighbourx -= 1;
newpos.X = 254; newpos.X = 255.9F;
} }
if (pos.X > 252) if (pos.X > 255)
{ {
neighbourx += 1; neighbourx += 1;
newpos.X = 1; newpos.X = 0.1F;
} }
if (pos.Y < 3) if (pos.Y < 1)
{ {
neighboury -= 1; neighboury -= 1;
newpos.Y = 254; newpos.Y = 255.9F;
} }
if (pos.Y > 252) if (pos.Y > 255)
{ {
neighboury += 1; neighboury += 1;
newpos.Y = 1; newpos.Y = 0.1F;
} }
LLVector3 vel = this.m_velocity; LLVector3 vel = this.m_velocity;

View File

@ -103,20 +103,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep);
if (actor.Position.Y < 0) if (actor.Position.Y < 0)
{ {
actor.Position.Y = 0; actor.Position.Y = 0.1F;
} }
else if (actor.Position.Y > 256) else if (actor.Position.Y >= 256)
{ {
actor.Position.Y = 256; actor.Position.Y = 255.9F;
} }
if (actor.Position.X < 0) if (actor.Position.X < 0)
{ {
actor.Position.X = 0; actor.Position.X = 0.1F;
} }
else if (actor.Position.X > 256) else if (actor.Position.X > 256)
{ {
actor.Position.X = 256; actor.Position.X = 255.9F;
} }
float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f; float height = _heightMap[(int)actor.Position.Y * 256 + (int)actor.Position.X] + 1.2f;