AI gets stuck during wander task and does not recover since it never reaches its goal.

tenuki

New member
Is there a 'wander + avoid + unstick if colliding' task or do I have to code it? To be honest last playtest it was kinda hilarious to watch the players hack the mechanic and get all the patrolling security stuck, but...
 
What is it getting stuck on? An invalid destination? Are you using A* or navmesh?
 
Unity 2020.3.x, unity navmesh.

It's not a invalid destination, it gets 'stuck' on other AI, or in crannies and just remains there grinding away with no progress to the destination. I can edit the navmesh to prevent some of the crannies problem, but other AI or players that are standing around mostly can 'trap' them.

I'll try to get a video of it happening next time I am working on my project. Something like avoiding other non static scene entities or detecting that it is supposed to be moving but isn't and having routines to get out of that situation. Similar to my Roomba and stairs and obstacle detection.

I'm thinking of switching to A* for other reasons - I'm guessing your wander task is pretty much the same code for that navmesh system?
 
Ah, yeah, I would try A* since they have a free version you can test out. For this I would focus more on the pathfinding locomotion aspect, the behavior tree is just responsible for telling the agent where to move and then it's up to the agent to do the actual movement through the locomotion script. The A* locomotion is definitely worth a try.
 
Just took an hour to switch over to A* - omg, way better. Now I have different problems, my enemy AI is too good. lol.
 
Top