From e2de643c933ff901c876543a0a4cfe1352f189e2 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 24 Nov 2022 03:14:28 +0100 Subject: [PATCH] Update Pathfinding.cs At the moment the script takes the second to last node as the end node. --- Episode 9 - smooth path 02/Assets/Scripts/Pathfinding.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Episode 9 - smooth path 02/Assets/Scripts/Pathfinding.cs b/Episode 9 - smooth path 02/Assets/Scripts/Pathfinding.cs index f4fe09e..ba47858 100644 --- a/Episode 9 - smooth path 02/Assets/Scripts/Pathfinding.cs +++ b/Episode 9 - smooth path 02/Assets/Scripts/Pathfinding.cs @@ -97,7 +97,7 @@ Vector3[] SimplifyPath(List path) { for (int i = 1; i < path.Count; i ++) { Vector2 directionNew = new Vector2(path[i-1].gridX - path[i].gridX,path[i-1].gridY - path[i].gridY); if (directionNew != directionOld) { - waypoints.Add(path[i].worldPosition); + waypoints.Add(path[i - 1].worldPosition); } directionOld = directionNew; }