I need implement a door that let pass my units but now the enemy units

  • A* version: 5.3.5
  • Unity version: 6.0.47f

Hi, please, I need implement a door in my grid graph, this door only can let pass my units, and don’t let pass the enemy units, I try to implement this with a RVO obstacle component and flags it, but says that is deprecated, how I can do this? I don’t want create more graphs because this add performance, what is the right way.

image

Check the solutions on this page (Agent-Specific Pathfinding - A* Pathfinding Project) namely tags and the ITraversalProvider interface.

Hi @tealtxgr but this works with RVO collision? because my agents maybe pull his neighbors throw the door

You can maybe place an empty GameObject with an RVO Controller in the door that’s assigned to a layer that will keep neighbors from freely going through the door? Be warned there are some weird interactions with locked/stopped RVO agents but I’d say give it a test and see if that solution works for you.

I was trying, but the RVO have a circular shape, I need a rectangular shape, there is a way to get that shape? I remembers that before we can define and RVO agent, but now that is deprecated.

I still need help here please

In the “pragmatic solutions” camp, you can approximate a rectangle pretty well by stacking several circles…

image

1 Like

I guess my honest question here is if a square is fully necessary? I can’t see much harm from having a small circle (or two, or five, as pointed out by dvneal) if it functions correctly. On top of that, with RVO even if there was a square shaped obstacle for RVO they’d still basically just push up behind it and try and “pathfind” through it and it would look unnatural. Hence why I’d recommend ITraversalProvider still. I, honestly, don’t think RVO is a good fit for the job of “keeping a unit from going through a door”.

I think ITraversalProvider is probably the best solution, but there are a ton of pragmatic solutions that are possible, depending on your exact needs and circumstance.

  1. Have 2 separate graphs, and have the graph the enemies are walking on not extend into “safe areas,” like whatever is beyond the door, or
  2. Make the enemy too tall to pass through the door (even if it’s not visibly the case), or
  3. Make a “threshold” at the door that is too tall for the enemy to walk over, but not too tall for the player, by adjusting step size, or
  4. Make the enemy radius too wide to fit through the door, or
  5. Use a script to detect when the agent is near the door, and then give it a new pathfinding destination (give up and go back to the nest, or whatever), or
  6. Filter the destination locations when you generate them to make sure it never gets one that’s behind the door

And probably many more.

1 Like