Godot Version
4.5.1.stable
Question
hi, i made this simple math calculation to find the closest point in a specific radious (minDistance) around a player for path finding (agent = enemy, target = player)
var directionToCenter: Vector2 = agent.global_position - target.global_position
var magToCenter: float = directionToCenter.length()
var desiredTarget: Vector2 = Vector2(target.global_position.x + directionToCenter.x / magToCenter * minDistance,target.global_position.y + directionToCenter.y / magToCenter * minDistance)
agent.findPathToTarget(desiredTarget)
i was wondering if there is a faster way to do this (if it makes a noticeable difference)