fix: bakke-ud står-stille-ur måler 0,5 m, ikke pr. billede (v1.62.84)

This commit is contained in:
2026-10-08 10:33:08 +02:00
parent da9cd08d40
commit 7f1908ab0f
3 changed files with 10 additions and 3 deletions
+8 -2
View File
@@ -93,6 +93,7 @@ ADHitchCreep.REVERSE_OUT_REACHED_M = 1.5
ADHitchCreep.REVERSE_OUT_SPEED = 5 -- km/t
ADHitchCreep.REVERSE_OUT_TIMEOUT_MS = 90000
ADHitchCreep.REVERSE_OUT_STUCK_MS = 10000
ADHitchCreep.STILL_MOVE_M = 0.5 -- m: så langt skal den være kommet, før "står stille"-uret nulstilles
local function contains(list, value)
for _, item in ipairs(list or {}) do if item == value then return true end end
@@ -411,8 +412,13 @@ function ReverseOutTask:update(dt)
local wp = self.adEnv.ADGraphManager:getWayPointById(self.path[self.index])
if wp == nil then return self:finish("giveUp") end
local p = worldPos(vehicle.rootNode)
self.stillMs = (math.abs(p.x - self.last.x) + math.abs(p.z - self.last.z) < 0.02) and self.stillMs + dt or 0
self.last = p
-- står fast: ikke kommet STILL_MOVE_M fra sidste referencepunkt (pr. billede er krybefart kun ~2 cm — in-game
-- 8/10 v1.62.83 opgav den ved vejpunkt 5 af 9, mens den kørte)
if (p.x - self.last.x) ^ 2 + (p.z - self.last.z) ^ 2 >= ADHitchCreep.STILL_MOVE_M ^ 2 then
self.last, self.stillMs = p, 0
else
self.stillMs = self.stillMs + dt
end
local _, _, lz = worldToLocal(vehicle.rootNode, wp.x, p.y, wp.z)
local distance = math.sqrt((p.x - wp.x) ^ 2 + (p.z - wp.z) ^ 2)
-- nået: tæt nok på, eller kørt forbi (vejpunktet ligger nu foran traktoren, når den bakker)