From 21d8a6b0e8f1480a5ac75ae4e76d01d4ae2fb13f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 3 Aug 2011 23:06:18 +0100 Subject: extend move test to check one beat of the simulator without actually asking the npc to move. --- .../Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Physics/BasicPhysicsPlugin') 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 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.Position.Z + (actor.Velocity.Z*timeStep) < - _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2) + if (actor.Position.Z + (actor.Velocity.Z * timeStep) < terrainHeight + 2) { actorPosition.Z = height; actorVelocity.Z = 0; @@ -135,7 +139,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin } else { - actorPosition.Z += actor.Velocity.Z*timeStep; + actorPosition.Z += actor.Velocity.Z * timeStep; actor.IsColliding = false; } } -- cgit v1.1