From f868b6f96b59e030caa00e5db0f2140aefa6af50 Mon Sep 17 00:00:00 2001 From: bash Date: Sat, 30 May 2026 14:37:38 +0200 Subject: [PATCH] fix(Core/RPG): Require LOS from candidate to GO in MoveWorldObjectTo --- src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp index 2877ee76a..54bb834fe 100644 --- a/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp +++ b/src/Ai/World/Rpg/Action/NewRpgBaseAction.cpp @@ -562,10 +562,19 @@ bool NewRpgBaseAction::MoveWorldObjectTo(ObjectGuid guid, float distance) float y = object->GetPositionY() + std::sin(angle) * distance; float z = object->GetPositionZ(); - // LOS check at eye height. + // LOS check at eye height — bot must be able to reach the candidate. if (!bot->IsWithinLOS(x, y, z + bot->GetCollisionHeight())) continue; + // Candidate must also have LOS to the GO itself — otherwise the + // bot arrives at a spot where it can't interact (e.g., a tree + // stands between candidate and GO). Without this, the very first + // angle (toward the bot) wins and lands the bot up against the + // obstacle instead of forcing iteration to an angle on the GO's + // far side from the blocker. + if (!object->IsWithinLOS(x, y, z + bot->GetCollisionHeight())) + continue; + // Strict navmesh-snap validation (cmangos ClosestCorrectPoint port). if (navMeshQuery) {