I’m working on a RTS and using the A* Pathfinding Project. Looks like a very good library, however I’m stuck.
Whenever I select more than one unit and move them, they tend to get blocked by each other while trying to reach their destination or attacking an enemy for example.
I figured I would have each be a dynamic obstacle (using the script from the examples) however the movement of each unit becomes extremely jerky, because it’s basically saying each unit is an obstacle of itself.
Is there a way to make it so every unit works as an obstacle to every other unit in the game, except itself ?
try using RVOObstacle
theres also an example (something with rvoobstacleSquare)
@superjayjay : are you using the A* PRO version with local avoidance ?
If no, RVO (local avoidance) is exactly what you need for a RTS.
If yes, you must not add RVOObstacle to your moving units, they should already have an AI path script calling their RVOController component.
In case of your moving units have colliders and can physically block others, I suggest you to have a bigger radius in your RVOController than the collider size.
Mmmh how do I add RVO ? I don’t own the pro version and I can’t seem to find any examples or scripts.
Thanks for the help so far
Sorry if my previous message wasn’t clear, English is not my primary language. Local Avoidance (RVO) is a feature only available in the PRO version.
Since I can’t afford the Pro version yet how can I do it without RVO ?
By the way I thought of making them act as obstacles once they are stopped and then act as non obstacles when they are moving, which should fix the more serious pathfinding problems I’m having, but how I can do it ?
It is possible, albeit a bit tricky, to use GraphUpdateObjects (see the page on graph updating during runtime in the docs) to make the ground around an agent unwalkable when it is standing still and revert it to walkable when it starts to move again. This can fix some of the issues, but will not work for units where there is lots of congestion or when all units are moving. For that you will need some local avoidance. There are free alternatives, e.g UnitySteer and also a C# version of the RVO2 Library (which my implementation is heavily inspired by). They both have their drawbacks and advantages. Try them.