From 6cb3833021a15e1f62ed198de8845b7332a2152b Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Fri, 3 Aug 2007 21:54:21 +0000 Subject: [PATCH] OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs, OpenSim/Region/Environment/Scenes/ScenePresence.cs Fix for array out-of-bounds error in basicphysics. --- .../Region/Environment/Scenes/ScenePresence.cs | 18 +++++++++--------- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 7b97080eb0..6c1e835ba2 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -550,7 +550,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 pos2 = this.Pos; LLVector3 vel = this.Velocity; - float timeStep = 0.2f; + float timeStep = 0.1f; pos2.X = pos2.X + (vel.X * timeStep); pos2.Y = pos2.Y + (vel.Y * timeStep); pos2.Z = pos2.Z + (vel.Z * timeStep); @@ -576,25 +576,25 @@ namespace OpenSim.Region.Environment.Scenes uint neighbourx = this.m_regionInfo.RegionLocX; uint neighboury = this.m_regionInfo.RegionLocY; - if (pos.X < 3) + if (pos.X < 1) { neighbourx -= 1; - newpos.X = 254; + newpos.X = 255.9F; } - if (pos.X > 252) + if (pos.X > 255) { neighbourx += 1; - newpos.X = 1; + newpos.X = 0.1F; } - if (pos.Y < 3) + if (pos.Y < 1) { neighboury -= 1; - newpos.Y = 254; + newpos.Y = 255.9F; } - if (pos.Y > 252) + if (pos.Y > 255) { neighboury += 1; - newpos.Y = 1; + newpos.Y = 0.1F; } LLVector3 vel = this.m_velocity; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index b722fdf2a4..6732d98a55 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -103,20 +103,20 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin actor.Position.Y = actor.Position.Y + (actor.Velocity.Y * timeStep); 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) { - actor.Position.X = 0; + actor.Position.X = 0.1F; } 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;