Support Forum

Penalties are wrongly updated in RecastGraph

Hello everyone.
I am making a construction system.
When adding a piece and updating the RecastGraph, the penalties are updated around the piece and not just on the surface of the piece.

The red area is a high penalty and the green area is a low penalty.

The code:

        var g = GetComponent<GraphUpdateScene>();
	AstarPath.active.UpdateGraphs(g.GetBounds());

Any ideas?

Hi

A graph update on a recast graph will recalculate a whole tile from scratch. This will nullify any penalties or tags you may have previously added to it.
I would recommend that you instead use tags. In the beta version (A* Pathfinding Project), you can use the RecastMeshObj component to mark the surface of an object as having a specific tag.