Hi!
Right now i'm trying to make my enemies (there is going to be a bunch of them) able to sense if their intended path is obstructed and have secondary, less desirable paths that they could consider. It wold also allow me to arbitrarily weight on those to change enemy logic
Pretty much like in this video: https://www.youtube.com/watch?v=6BrZryMz-ac&t=167s
I'm experimenting, right now i've added 8 raycast nodes to an enemy for basic directions and i intend to follow the signal up logic, which means they all get a script with a signal for "there is a body" and a signal for "there is no body" so that i can have a variable in the main enemy script for each containing a boolean
After that in the main script there would be 8 variables (1 for each direction) that are true or false.
I need to learn how to convert the direction vector provided by the navigation agent into an angle and compare that angle to the cardinal directions to determine what directions are close to the intended path, then have the enemy select the closest one that is not obstructed
To do that each direction variable that isn't eliminated because obstructed would receive an integer value, the highest wins for this frame
I can then add extra stuff to weight on that decision for more complex behaviors. I guess it makes me wonder how i'm going to make them walk around each other towards the shortest path to their destination though...
Is this a good way to do it, is it good practice, is it going to be bad on performance? That's a lot of variables, signals and raycasts to multiply by the number of enemies and in this case they're going to be numerous