Missing basic dynamic obstacle script

An RTS game needs dynamic obstacles to create a path around the units. This is a very basic feature (cheaper versions all have it) which should be implemented independently of the RVO feature.

I am using penalties to avoid stationary units.


But penalties means, that if there is no other way, go through the penalty nodes?.. So, at the end it fails?

A simple, but good solution for dynamic obstacles is described here:


Thank you for your answer,

yes i already know that issues, which can be solved simply by your great asset. There seems to be everything is available in your scripts, but the hard part is to figure out how to do more complicated things and how to realise it in your API. I guess, i could write now a very mudular, more concrete pathfinding scripts on the top of yours, which would generate automatically grid graphs depends on the AI size, handle more units, give them a priority based formation algorithm, providing different steering behaviors and so on.


Just released version 3.5 with local avoidance included.
Check out the “Terrain” example scene, it has a moving obstacle. It uses the DynamicGridObstacle script.

However you should NOT use a dynamic obstacle script for units, the reason is that if you do that, the units will always think that the ground they stand on is unwalkable, so they will try to move away from it. A solution like ElvisChampion is acceptable, you could also just mark the nodes as unwalkable, but this can easily lead to issues where there is no valid path at all because some units have blocked it off.

ElvisChampion approach is interesting, but if i have a lot of units moving only to one point, then sometimes some units have just higher penalty nodes as neighbor nodes. On the higher penalty nodes are units and the pathfinding will give a path through the neughbor units.

Sounds good for starting a group of units at the same time near to each other, of they have a kind of local avoidance.

Does it means, that generally the ‘too’ dynamic obstacles (units, but not buildings which can be built) should never make the nodes unwalkable, or probably sometimes making a node unwalkable (at ariving, stopping) and making it walkable at starting makes more sense?

Yes. Moving units should probably not make nodes unwalkable. Changing penalties or tags is a better way to go.

Thanks, manipulated the DynamicObstacleScript.cs to look on the GameObject-Layer and depends on it makes the node unwalkable (for idle-obstacle) or just gives them a penalty (for moving-obstacle). On open field the same behavior, but in narrow streets no monkey business anymore.