if a move to target is set underground, constrain it to the terrain height

bulletsim
Justin Clark-Casey (justincc) 2011-08-04 01:45:56 +01:00
parent 61a931490d
commit c678b75d65
1 changed files with 3 additions and 1 deletions

View File

@ -1635,7 +1635,6 @@ namespace OpenSim.Region.Framework.Scenes
if (LocalVectorToTarget3D.Y > 0) //MoveLeft
{
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
//AgentControlFlags
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
updated = true;
}
@ -1704,6 +1703,9 @@ namespace OpenSim.Region.Framework.Scenes
// pos.Z = AbsolutePosition.Z;
// }
float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
pos.Z = Math.Max(terrainHeight, pos.Z);
m_moveToPositionInProgress = true;
MoveToPositionTarget = pos;