aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs8
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs12
2 files changed, 15 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 46e39ef..4e2b5f1 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
87 public void TestMove() 87 public void TestMove()
88 { 88 {
89 TestHelper.InMethod(); 89 TestHelper.InMethod();
90 log4net.Config.XmlConfigurator.Configure(); 90// log4net.Config.XmlConfigurator.Configure();
91 91
92 IConfigSource config = new IniConfigSource(); 92 IConfigSource config = new IniConfigSource();
93 93
@@ -106,6 +106,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
106 ScenePresence npc = scene.GetScenePresence(npcId); 106 ScenePresence npc = scene.GetScenePresence(npcId);
107 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); 107 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
108 108
109 // For now, we'll make the scene presence fly to simplify this test, but this needs to change.
110 npc.PhysicsActor.Flying = true;
111
112 scene.Update();
113 Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
114
109 // Not yet complete 115 // Not yet complete
110 } 116 }
111 } 117 }
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 6c9d9ab..1ceed1a 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -123,11 +123,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
123 actorPosition.X = ((int)Constants.RegionSize - 0.1f); 123 actorPosition.X = ((int)Constants.RegionSize - 0.1f);
124 } 124 }
125 125
126 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; 126 float terrainHeight = 0;
127 if (_heightMap != null)
128 terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X];
129
130 float height = terrainHeight + actor.Size.Z;
131
127 if (actor.Flying) 132 if (actor.Flying)
128 { 133 {
129 if (actor.Position.Z + (actor.Velocity.Z*timeStep) < 134 if (actor.Position.Z + (actor.Velocity.Z * timeStep) < terrainHeight + 2)
130 _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
131 { 135 {
132 actorPosition.Z = height; 136 actorPosition.Z = height;
133 actorVelocity.Z = 0; 137 actorVelocity.Z = 0;
@@ -135,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
135 } 139 }
136 else 140 else
137 { 141 {
138 actorPosition.Z += actor.Velocity.Z*timeStep; 142 actorPosition.Z += actor.Velocity.Z * timeStep;
139 actor.IsColliding = false; 143 actor.IsColliding = false;
140 } 144 }
141 } 145 }