I am trying to design an algorithm to detect the closest point where an agent has line of sight to another specified agent in 3D space and to move towards that point.
The use case would be a turn based strategy game where the AI has to move into a position where they can shoot the player’s unit. The AI agent can only move a limited distance per turn and their weapon has a limited range. They would ideally be positioned where they have line of sight to the player’s unit and they are at the max range of their weapon.
At the moment I have a nav mesh set up which can allow the AI agent to move towards arbitrary points on the map with the shortest distance using A* but I am stuck on trying to figure out the best positions to move into where they can shoot the player’s unit. Any advice?
I am using Unity Navmeshes.