0

I am trying to make a 2d top-down game where the player moves obstacles in order to block enemy AI from advancing, but I need the obstacles to only block certain types of enemies.

I've tried using Unity obstacles but they carve through every navmesh so every Agent will avoid them (And I need to set them to carve because I need enemies to take another path if they are stuck) I've thought about having an obstacle that change the area beneath it instead of carving through the mesh, but I haven't seen any ways to dynamically do that without baking the whole navmesh again.

Is there any way to do that, or a plugin that could give me those features ? Thank you

TitouanGL
  • 3
  • 1
  • 1
    You would have to have a diferent navmesh for each enemy type it seems... You could try non-carving obsticles and set each type to a different layer... but it doens't seem like a great solution long term – Jay Jun 19 '23 at 08:43
  • add a NavMeshObstacle and check "Curve". if it does't work try box collider with rigidbody (check is kinematick") – BlackSperm Jun 19 '23 at 18:19

1 Answers1

0

You should definitely check out the A* Pathfinding Project. After using this I really can't go back to using Unity's built-in navmesh system.

https://arongranberg.com/astar/

https://youtu.be/46qZgd-T-hk

They have built in solutions for exactly your type of situation, ie. there are different layers/groups of AI.

There is a free version available if you would like to try it out

https://arongranberg.com/astar/download

Here's a comparison between Free and Pro

https://arongranberg.com/astar/freevspro

gjtiquia
  • 96
  • 3