From a29842ab66652c67f0fec92c5566d1ddc5428dc7 Mon Sep 17 00:00:00 2001 From: schwiti6190 <58079399+schwiti6190@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:53:50 +0200 Subject: [PATCH] Small fix --- scripts/ai/Markers.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ai/Markers.lua b/scripts/ai/Markers.lua index fcebd35a8..e23de0c29 100644 --- a/scripts/ai/Markers.lua +++ b/scripts/ai/Markers.lua @@ -36,23 +36,23 @@ local function setBackMarkerNode(vehicle, measuredBackDistance) if AIUtil.hasImplementsOnTheBack(vehicle) then local lastImplement lastImplement, backMarkerOffset = AIUtil.getLastAttachedImplement(vehicle) - referenceNode = AIUtil.getDirectionNode(vehicle) + referenceNode = AIUtil.getDirectionNode(vehicle) CpUtil.debugVehicle(CpDebug.DBG_IMPLEMENTS, vehicle, 'Using the last implement\'s rear distance for the back marker node, %d m from root node', backMarkerOffset) elseif measuredBackDistance then - referenceNode = AIUtil.getDirectionNode(vehicle) + referenceNode = AIUtil.getDirectionNode(vehicle) backMarkerOffset = -measuredBackDistance CpUtil.debugVehicle(CpDebug.DBG_IMPLEMENTS, vehicle, 'back marker node on measured back distance %.1f', measuredBackDistance) elseif reverserNode then -- if there is a reverser node, use that, mainly because that most likely will turn with an implement -- or with the back component of an articulated vehicle. Just need to find out the distance correctly - local dx, _, dz = localToLocal(reverserNode, AIUtil.getDirectionNode(vehicle), 0, 0, 0) + local dx, _, dz = localToLocal(reverserNode, AIUtil.getDirectionNode(vehicle), 0, 0, 0) local dBetweenRootAndReverserNode = MathUtil.vector2Length(dx, dz) backMarkerOffset = dBetweenRootAndReverserNode - vehicle.size.length / 2 - vehicle.size.lengthOffset referenceNode = reverserNode CpUtil.debugVehicle(CpDebug.DBG_IMPLEMENTS, vehicle, 'Using the %s node for the back marker node %d m from root node (%d m between root and reverser)', debugText, backMarkerOffset, dBetweenRootAndReverserNode) else - referenceNode = AIUtil.getDirectionNode(vehicle) + referenceNode = AIUtil.getDirectionNode(vehicle) backMarkerOffset = - vehicle.size.length / 2 + vehicle.size.lengthOffset CpUtil.debugVehicle(CpDebug.DBG_IMPLEMENTS, vehicle, 'Using the vehicle\'s root node for the back marker node, %d m from root node', backMarkerOffset) end