{"record":{"id":"8538d980ce401fa0","repo":"babalae/better-genshin-impact","slug":"error-8538d9","errorCode":null,"errorMessage":"横向移动偏移量校准失败","messagePattern":"横向移动偏移量校准失败","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"BetterGenshinImpact/GameTask/AutoTrackPath/AutoTrackPathTask.cs","lineNumber":127,"sourceCode":"        // 1. 传送到最近的传送点\n        var first = _way.WayPointList[0]; // 解析路线，第一个点为起点\n        await new TpTask(_ct).Tp(first.Pt.X, first.Pt.Y);\n\n        // 2. 等待传送完成\n        Sleep(1000);\n        NewRetry.Do((Action)(() =>\n        {\n            var ra = TaskControl.CaptureToRectArea();\n            var miniMapMat = GetMiniMapMat(ra) ?? throw new RetryException(\"等待传送完成\");\n        }), TimeSpan.FromSeconds(1), 100);\n        Logger.LogInformation(\"传送完成\");\n        Sleep(1000);\n\n        // 3. 横向移动偏移量校准，移动指定偏移、按下W后识别朝向\n        var angleOffset = GetOffsetAngle();\n        if (angleOffset == 0)\n        {\n            throw new InvalidOperationException(\"横向移动偏移量校准失败\");\n        }\n\n        // 4. 针对点位进行直线追踪\n\n        var trackCts = new CancellationTokenSource();\n        _ct.Register(trackCts.Cancel);\n        var trackTask = Track(_way.WayPointList, angleOffset, trackCts);\n        trackTask.Start();\n        var refreshStatusTask = RefreshStatus(trackCts.Token);\n        refreshStatusTask.Start();\n        var jumpTask = Jump(trackCts.Token);\n        jumpTask.Start();\n        await Task.WhenAll(trackTask, refreshStatusTask, jumpTask);\n    }\n\n    private MotionStatus _motionStatus = MotionStatus.Normal;\n\n    public Task Jump(CancellationToken trackCt)","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/babalae/better-genshin-impact/blob/a7cb36712dcb409be610257d877fcea3597e9d6b/BetterGenshinImpact/GameTask/AutoTrackPath/AutoTrackPathTask.cs#L109-L145","documentation":"InvalidOperationException from AutoTrackPathTask.DoTask when GetOffsetAngle() returns 0. GetOffsetAngle moves the mouse horizontally by CharMovingUnit units, presses W briefly, then computes angle2-angle1 via CharacterOrientation.Compute on the minimap. A zero result means the character's heading did not change at all after the simulated move — the calibration is unusable, so straight-line tracking cannot proceed.","triggerScenarios":"Minimap heading (CharacterOrientation.Compute) returned the same angle before and after the move because the move was blocked (wall/cutscene), the minimap template failed to match in both samples, or SendInput mouse/keyboard did not reach the game (input injection blocked).","commonSituations":"Character against a wall during calibration so W produces no rotation; SendInput blocked by an overlay with input focus; game running as admin so the app cannot inject; minimap occluded; GetCharacterOrientationAngle threw 'not in main UI' earlier and the value defaulted.","solutions":["Ensure the character is standing on open, flat ground at the calibration moment (no wall/freeze).","Run the tool with sufficient privileges so SendInput reaches Genshin; confirm input injection works.","Confirm the game window has foreground focus during calibration.","Clear any overlay occluding the minimap region GetMiniMapMat reads.","Retry the task — a transient cutscene/loading stall at calibration time yields angleOffset 0."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { var offset = GetOffsetAngle(); }\ncatch (InvalidOperationException e) when (e.Message.Contains(\"横向移动偏移量校准失败\"))\n{ /* re-position avatar to open ground, ensure focus, retry calibration */ }","preventionTips":["Run calibration only on open flat ground with the character free to move.","Confirm SendInput reaches the game (privileges + foreground focus) before tracking.","Validate the minimap/PaimonMenu template matches before entering calibration."],"tags":["calibration","movement","input-injection","minimap","auto-track"],"backgroundTag":null,"analyzedSha":"a7cb36712dcb409be610257d877fcea3597e9d6b","analyzedAt":"2026-08-13T16:44:57.548Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}