From 2dbc18054e354a17519f84c0b3294094fae3b5b2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 29 Apr 2014 19:29:16 +0100 Subject: Add regression test for NPC movement on a variable region. Extends basic physics to allow av movement on a varregion (basic physics is only really useful for regression test purposes). --- .../Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs index 0816b7b..8e40561 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs @@ -46,6 +46,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin private List _actors = new List(); private List _prims = new List(); private float[] _heightMap; + private Vector3 m_regionExtent; //protected internal string sceneIdentifier; @@ -58,6 +59,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public override void Initialise(IMesher meshmerizer, IConfigSource config) { + throw new Exception("Should not be called."); + } + + public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) + { + m_regionExtent = regionExtent; } public override void Dispose() {} @@ -121,23 +128,23 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin { actorPosition.Y = 0.1F; } - else if (actor.Position.Y >= Constants.RegionSize) + else if (actor.Position.Y >= m_regionExtent.Y) { - actorPosition.Y = ((int)Constants.RegionSize - 0.1f); + actorPosition.Y = (m_regionExtent.Y - 0.1f); } if (actor.Position.X < 0) { actorPosition.X = 0.1F; } - else if (actor.Position.X >= Constants.RegionSize) + else if (actor.Position.X >= m_regionExtent.X) { - actorPosition.X = ((int)Constants.RegionSize - 0.1f); + actorPosition.X = (m_regionExtent.X - 0.1f); } float terrainHeight = 0; if (_heightMap != null) - terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X]; + terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; float height = terrainHeight + actor.Size.Z; -- cgit v1.1