Support Forum

Arches and Doorways: GridGraph vs LayeredGridGraph

PROBLEM

I’m using a ProceduralGridMover with a GridGraph to move my character around a dynamically loaded world. It works great out in the open, but I can’t walk under anything.

For instance, I have a castle wall with an arch in it. My character needs to be able to walk under the arch. However, when I scan, the area under the arch gets marked “unwalkable”.

To solve this, I fiddled with the Height Testing and found that if I use a Ray length that is shorter than the arch, it works. That’s great… as long as the world is totally flat and everything I might need to walk under is the same height. :frowning:

As soon as I have a hill with another arch on it, I run into one of two situations:

  • If the hill goes up, the short ray starts underground
  • If the hill goes down, the short ray starts above the arch

Either way, the area under the second arch becomes unwalkable. This also applies to other scenarios: tents in the marketplace, buildings with a doorway, bridges that arch up and over, etc. I can’t find a one-size-fits-all ray height.

QUESTIONS

1. Is there a simple trick that I’m missing with GridGraph?
2. Does LayeredGridGraph solve the archway problem? If so, what does LayeredGridGraph do differently that makes it work for doorways?
3. What’s the performance hit if I switch to LayerdGridGraph?

I see mention in the documentation / release notes that LayeredGridGraph works with ProceduralGridMover, but I also see mention that it is more expensive on performance. I know every game is different, but does anyone have any anecdotal estimates?

I assume I’m doing something silly if I’m considering a multi-layered approach to solve a simple doorway problem, but maybe that’s actually a limitation of GridGraph. If LayeredGridGraph can solve the problem, I’m ready to buy the Pro Version, but I’m trying to get an idea of whether this is a viable option before I purchase.

Thanks in advance!

Hi

Usually what you do in this case is to put the top of the arch on a different layer and make sure that the grid graph is does not use that layer in its collision/height testing settings.

  1. I suppose, but I would recommend the above solution anyway. No sense having nodes where you don’t want them.
  2. Not that significant, it uses a bit more memory though. I don’t have any concrete numbers right now though.
1 Like