I need help with getting a script that can find the shortest path between one point to another on a 2d plane… even if there are obsticals in the way. The obsticals will all have a collider on them. I am then going to have a GameObject travel along that path at “x” speed.
Any Ideas? I really am having trouble with this… I dont even know where to start looking.
If you want any type of intelligent path finding you’ll need to look into a pathfinding algorithm. The one I’ve heard of the most in video games is the A* (a-star) method.
The YouTuber @Dooobs has some videos showing off his A* pathfinding algorithms with demos that really helped me understand it.
Try this:A* Pathfinding Project - A* Pathfinding Project
Note: I must say I have not tried other pathfindings, so there may be something better out there. So consider that I talk as a newbie.
Opinion:
Wonderfull Pathfinding. I tried it after seeing here. In the last Unity version there is compile error because of the default function values. I had to clean default values, noted them on paper(definitely you should do so) and corrected the function calls. After that it works like a charm.
This pathfinding can be used in Editor, you can define which layers to avoid, which layers are walkable. Probably there are a lot more but I just started. A definitely must have. Saves you months and painful debugging.