A* Pathfinding Project

Different penalties based on layer mask


#1

Hi new here.

I am trying to build a recast graph on 2 different layers of meshes (for e.g. road and off road). What is the best way to set different penalties for the layers? (I want all meshes on the off road layer to have a larger penalty)

Tried using graph update scene but it requires me to specify a bounding polygon which sets all nodes (be it road or off road meshes) to a different penalty. I only want nodes on the off road mesh have a different penalty. Thanks in advance.


#2

Hi

This is not possible out of the box. However you can write a simple script that sets the penalties for you.

Here is an example of some code that changes the walkability from a separate script.

https://arongranberg.com/astar/docs/graphupdates.html#direct