Penalties based on distance from object

Okay so I love A* so far, but I’ve hit a rut.
My question is simple. Is there a way to assign penalties on grid based on distance to object?
So an agent will want to stay as far away from an object as it can, but can get close if it needs to?
Doing this in 2D if it matters to the question.


There is no built-in method for this exact use case however you can use the ITraversalProvider interface to assign custom penalties during runtime.
See the bottom of this page:

Alright I’ll look into this. Thanks!