extend move test to check one beat of the simulator without actually asking the npc to move.
parent
d78fe44191
commit
21d8a6b0e8
|
@ -87,7 +87,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
public void TestMove()
|
public void TestMove()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
IConfigSource config = new IniConfigSource();
|
IConfigSource config = new IniConfigSource();
|
||||||
|
|
||||||
|
@ -106,6 +106,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
ScenePresence npc = scene.GetScenePresence(npcId);
|
ScenePresence npc = scene.GetScenePresence(npcId);
|
||||||
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||||
|
|
||||||
|
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
|
||||||
|
npc.PhysicsActor.Flying = true;
|
||||||
|
|
||||||
|
scene.Update();
|
||||||
|
Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos));
|
||||||
|
|
||||||
// Not yet complete
|
// Not yet complete
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,11 +123,15 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
actorPosition.X = ((int)Constants.RegionSize - 0.1f);
|
actorPosition.X = ((int)Constants.RegionSize - 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z;
|
float terrainHeight = 0;
|
||||||
|
if (_heightMap != null)
|
||||||
|
terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X];
|
||||||
|
|
||||||
|
float height = terrainHeight + actor.Size.Z;
|
||||||
|
|
||||||
if (actor.Flying)
|
if (actor.Flying)
|
||||||
{
|
{
|
||||||
if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
|
if (actor.Position.Z + (actor.Velocity.Z * timeStep) < terrainHeight + 2)
|
||||||
_heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
|
|
||||||
{
|
{
|
||||||
actorPosition.Z = height;
|
actorPosition.Z = height;
|
||||||
actorVelocity.Z = 0;
|
actorVelocity.Z = 0;
|
||||||
|
@ -135,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actorPosition.Z += actor.Velocity.Z*timeStep;
|
actorPosition.Z += actor.Velocity.Z * timeStep;
|
||||||
actor.IsColliding = false;
|
actor.IsColliding = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue