diff --git a/src/BasicPathFinding.cs b/src/BasicPathFinding.cs index 54e2c2a..2ef6fca 100644 --- a/src/BasicPathFinding.cs +++ b/src/BasicPathFinding.cs @@ -7,6 +7,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api; +using Roy_T.AStar.Graphs; using Roy_T.AStar.Grids; using Roy_T.AStar.Paths; using Roy_T.AStar.Primitives; @@ -427,6 +428,15 @@ namespace OpenSim.Modules.PathFinding Velocity _pathFindingVelocity = Velocity.FromKilometersPerHour(11.5f); Grid _pathFindingGrid = Grid.CreateGridWithLateralAndDiagonalConnections(_pathFindingGridSize, _pathFindingCellSize, _pathFindingVelocity); + + foreach(INode _thisNode in _pathFindingGrid.GetAllNodes()) + { + PathNode _node = _env.Nodes.Find(X => X.PositionX == (int)_thisNode.Position.X && X.PositionY == (int)_thisNode.Position.Y); + + if(_node == null) + _pathFindingGrid.RemoveDiagonalConnectionsIntersectingWithNode(new GridPosition((int)_thisNode.Position.X, (int)_thisNode.Position.Y)); + } + PathFinder pathFinder = new PathFinder(); Path _pathFindingPath = pathFinder.FindPath(new GridPosition(_startNode.PositionX, _startNode.PositionY), new GridPosition(_targetNode.PositionX, _targetNode.PositionY), _pathFindingGrid);