From 6f6db6d26f3c2a50fcd3677f7acde404816e7fd6 Mon Sep 17 00:00:00 2001 From: funkyfranky Date: Sun, 11 Feb 2018 17:17:13 +0100 Subject: [PATCH] Added last waypoint to RouteGroundOnRoad function if that is not on road. --- Moose Development/Moose/Wrapper/Controllable.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index d9849d713..da80377e7 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -1953,6 +1953,12 @@ function CONTROLLABLE:RouteGroundOnRoad( ToCoordinate, Speed, DelaySeconds ) table.insert(route, coord:WaypointGround(Speed, Formation)) end + -- Add the final coordinate because the final coordinate in path is last point on road. + local dist=ToCoordinate:Get2DDistance(path[#path]) + if dist>10 then + table.insert(route, ToCoordinate:WaypointGround(Speed, "Vee")) + end + -- Route controllable to destination. self:Route(route, DelaySeconds)