Good day
I’m making an RTS game and I need my units to automaticaly find the best firing position for attacking a target. Here is an example:
I give my unit an order to attack the enemy. My unit is currently out of range and has to move to a firing position. Normally the firing position is a closest node to a unit, which is also on weapon attack range from the enemy. But it’s not that simple. The firing point should also have a line of sight to the target. So it should be closest to a unit, be on a firing range and should have a line of sight to an enemy. How can I accomplish this using your A* library? My guess is to check line of sight and distance to a target on each iteration of A* and when all the conditions will be fulfilled - get a path to that node. Could you give me some examples how can I program that? To be more precise, I don’t need any algorithms to check distance and line of sight. Infact, I have a sepparate Unity module for this tasks. What I need is some override function, which is called on every node check (for example the function that calculates the F parameter of the node and checks if path is already found). Thank you!