Added last waypoint to RouteGroundOnRoad function if that is not on road.

This commit is contained in:
funkyfranky 2018-02-11 17:17:13 +01:00
parent f69f666deb
commit 6f6db6d26f

View File

@ -1953,6 +1953,12 @@ function CONTROLLABLE:RouteGroundOnRoad( ToCoordinate, Speed, DelaySeconds )
table.insert(route, coord:WaypointGround(Speed, Formation)) table.insert(route, coord:WaypointGround(Speed, Formation))
end 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. -- Route controllable to destination.
self:Route(route, DelaySeconds) self:Route(route, DelaySeconds)