A* Pathfinding Project

Using Pathfinding with gameobjects that have an action when stuck by specific objects


#1

Hello,
I am planning to use pathfinding for a cop chasing player(s) , this cop would have to break “furniture” that might block the path though.

I was curious if this was possible and if so, how? I’m just looking into different assets to see what I can use for this.

Thanks!


#2

Hi

What you can do is to mark each node that contains an object that can be destroyed with a specific tag (see https://arongranberg.com/astar/docs/tags.php). Then you can allow your units to traverse that tag, but perhaps with a higher penalty. Later when you request a path the units will try to avoid furniture unless they can find a much quicker path by going through those nodes. You’ll have to add logic to your agents to make them stop if they detect there is a piece of furniture in front of them and they want to move in that direction.