Index: ps/trunk/source/simulation2/components/CCmpUnitMotion.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpUnitMotion.cpp +++ ps/trunk/source/simulation2/components/CCmpUnitMotion.cpp @@ -1316,10 +1316,6 @@ if (!ComputeTargetPosition(targetPos)) return false; - // Fail if the target is too far away - if ((targetPos - from).CompareLength(DIRECT_PATH_RANGE) > 0) - return false; - CmpPtr cmpPathfinder(GetSystemEntity()); if (!cmpPathfinder) return false; @@ -1336,6 +1332,10 @@ // Find the point on the goal shape that we should head towards CFixedVector2D goalPos = goal.NearestPointOnGoal(from); + // Fail if the target is too far away + if ((goalPos - from).CompareLength(DIRECT_PATH_RANGE) > 0) + return false; + // Check if there's any collisions on that route. // For entity goals, skip only the specific obstruction tag or with e.g. walls we might ignore too many entities. ICmpObstructionManager::tag_t specificIgnore;