How to get different penalties for the same region of graph

I have a game world comprising of open spaces and buildings. Vehicles can’t travel through buildings but infantry can, albeit at a penalty. This sounds like a very common scenario but I can’t find a (the) solution to handle it.

I can see two ways to look at this…

  1. The penalty for nodes under a building are maxed out for vehicles yet not so for infantry units.

or…

  1. There are two different A* graphs, one that is processed for use for the vehicles and one set up for the infantry units.

Now, number 1 isn’t possible because there can only be one penalty value per graph node, yet number 2 seems like overkill.

Is there a proper solution to this problem?

Thanks.

Hi

Yes there is. You use tags.
For example you can tag the interior of your buildings with the tag “Indoors” and the specify on the Seeker component that infantry should have a high penalty for traversing that tag and the vehicles should not be able to traverse it at all.
See http://arongranberg.com/astar/docs/tags.php

Thanks.

A bit embarrassing to have asked a question that is clearly in the docs. Looks like I was looking completely in the wrong places.