AI to destroy obstacles (doors/placed barriers) when chasing player


I am having difficult time with thinking of a solution to making AI destroy barriers that are blocking way to player.

My idea is to have obstacles that does not block navigation for AI, and add trigger voluems for those objects. When enemy is chasing player (target is != null) then store this target in different variable and attack the obstacle. When obstacle is destroyed set back player as target.

Idea is simple and before starting to implement I was wandering if there are better techniques to do this. Also I do not like this part with trigger volume - but I couldn’t think of something different.

It’s possible to pause movement requests for an AAIController (PauseMove), so you could use that rather than storing state somewhere else. You’d still need a trigger volume or similar to know when the AI should pause and start another task to destroy the obstacle.

Do a line trace for the enemy’s line of sight, use custom trace channels to pick destructible objects. And then include addition code if the Hit value is true.

Ok thanks for responses!

I think I am gonna mix both your suggestions and do a short trace in front of bot to detect obstacle and then if hit I am gonna PauseMove to destroy obstacle (or maybe add a state in Behaviur Tree to do the task). Gonna experiment now :slight_smile: Thanks a lot again!

One more thing - if I have 30 bots each one with line trace - is it costly or should I use triggers then?

I got prototype up and running - works like a charm :slight_smile: Thanks again!