diff options
author | Justin Clark-Casey (justincc) | 2014-04-29 19:29:16 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-04-29 19:29:16 +0100 |
commit | 2dbc18054e354a17519f84c0b3294094fae3b5b2 (patch) | |
tree | 83cc0d4f25e711464fad07ae28da56dfe278c498 /OpenSim/Region/Physics | |
parent | Improved HTTP logging (diff) | |
download | opensim-SC_OLD-2dbc18054e354a17519f84c0b3294094fae3b5b2.zip opensim-SC_OLD-2dbc18054e354a17519f84c0b3294094fae3b5b2.tar.gz opensim-SC_OLD-2dbc18054e354a17519f84c0b3294094fae3b5b2.tar.bz2 opensim-SC_OLD-2dbc18054e354a17519f84c0b3294094fae3b5b2.tar.xz |
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).
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 17 |
1 files changed, 12 insertions, 5 deletions
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 | |||
46 | private List<BasicActor> _actors = new List<BasicActor>(); | 46 | private List<BasicActor> _actors = new List<BasicActor>(); |
47 | private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); | 47 | private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); |
48 | private float[] _heightMap; | 48 | private float[] _heightMap; |
49 | private Vector3 m_regionExtent; | ||
49 | 50 | ||
50 | //protected internal string sceneIdentifier; | 51 | //protected internal string sceneIdentifier; |
51 | 52 | ||
@@ -58,6 +59,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
58 | 59 | ||
59 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 60 | public override void Initialise(IMesher meshmerizer, IConfigSource config) |
60 | { | 61 | { |
62 | throw new Exception("Should not be called."); | ||
63 | } | ||
64 | |||
65 | public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) | ||
66 | { | ||
67 | m_regionExtent = regionExtent; | ||
61 | } | 68 | } |
62 | 69 | ||
63 | public override void Dispose() {} | 70 | public override void Dispose() {} |
@@ -121,23 +128,23 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
121 | { | 128 | { |
122 | actorPosition.Y = 0.1F; | 129 | actorPosition.Y = 0.1F; |
123 | } | 130 | } |
124 | else if (actor.Position.Y >= Constants.RegionSize) | 131 | else if (actor.Position.Y >= m_regionExtent.Y) |
125 | { | 132 | { |
126 | actorPosition.Y = ((int)Constants.RegionSize - 0.1f); | 133 | actorPosition.Y = (m_regionExtent.Y - 0.1f); |
127 | } | 134 | } |
128 | 135 | ||
129 | if (actor.Position.X < 0) | 136 | if (actor.Position.X < 0) |
130 | { | 137 | { |
131 | actorPosition.X = 0.1F; | 138 | actorPosition.X = 0.1F; |
132 | } | 139 | } |
133 | else if (actor.Position.X >= Constants.RegionSize) | 140 | else if (actor.Position.X >= m_regionExtent.X) |
134 | { | 141 | { |
135 | actorPosition.X = ((int)Constants.RegionSize - 0.1f); | 142 | actorPosition.X = (m_regionExtent.X - 0.1f); |
136 | } | 143 | } |
137 | 144 | ||
138 | float terrainHeight = 0; | 145 | float terrainHeight = 0; |
139 | if (_heightMap != null) | 146 | if (_heightMap != null) |
140 | terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X]; | 147 | terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; |
141 | 148 | ||
142 | float height = terrainHeight + actor.Size.Z; | 149 | float height = terrainHeight + actor.Size.Z; |
143 | 150 | ||