Fixed exception when planning results in an empty path.
parent
0304b635a6
commit
5cabf4ca28
|
@ -163,8 +163,13 @@ public class NavigationComponent : Spatial
|
||||||
|
|
||||||
// Perform smoothing
|
// Perform smoothing
|
||||||
_planningPathSmoothedWorldNavigationPoints = SmoothPath(body, _planningPathWorldNavigationPoints);
|
_planningPathSmoothedWorldNavigationPoints = SmoothPath(body, _planningPathWorldNavigationPoints);
|
||||||
|
|
||||||
|
// Ensure starting point is the current position
|
||||||
|
if (_planningPathSmoothedWorldNavigationPoints.Count > 0)
|
||||||
|
{
|
||||||
_planningPathSmoothedWorldNavigationPoints[0] = new NavigationPoint(fromPositionWorld);
|
_planningPathSmoothedWorldNavigationPoints[0] = new NavigationPoint(fromPositionWorld);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void FindPath(KinematicBody body, Vector3 fromPositionWorld, NavigationPoint navigationPoint)
|
public void FindPath(KinematicBody body, Vector3 fromPositionWorld, NavigationPoint navigationPoint)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue