Fixed exception when planning results in an empty path.

WorldChunkRefactoring
Martin Felis 2023-11-01 12:34:28 +01:00
parent 0304b635a6
commit 5cabf4ca28
1 changed files with 6 additions and 1 deletions

View File

@ -163,8 +163,13 @@ public class NavigationComponent : Spatial
// Perform smoothing
_planningPathSmoothedWorldNavigationPoints = SmoothPath(body, _planningPathWorldNavigationPoints);
// Ensure starting point is the current position
if (_planningPathSmoothedWorldNavigationPoints.Count > 0)
{
_planningPathSmoothedWorldNavigationPoints[0] = new NavigationPoint(fromPositionWorld);
}
}
public void FindPath(KinematicBody body, Vector3 fromPositionWorld, NavigationPoint navigationPoint)
{