- Home /
A* waypoint movement for player
Hi, I'm struggling to get a waypoint system working. Where you set up a bunch of nodes (They are connected) and when you click on one, the player will traverse nodes so create the shortest path. (Like monument valley navigation). I don't want to use a navmesh, just A* logic and Nodes. Where should I start? I've put up a few other questions with similar issues to this one, but there's been no solution yet. Thanks
Answer by DrawMen1999 · Sep 10, 2019 at 04:15 PM
A little while ago I followed a tutorial series by Sebastian Lague, he gradually builds up a pretty good a* navigation system. I recommend implementing at least the basic algorithm and heap optimisation system.
https://www.youtube.com/watch?v=-L-WgKMFuhE&list=PLFt_AvWsXl0cq5Umv3pMC9SPnKjfp9eGW
Answer by JonPQ · Sep 10, 2019 at 03:52 PM
make yourself a prefab called node... empty gameObject... use OnGizmos to render it in the scene, but not in the game view... Place a bunch of them in your level. Next either make a script you can add to nodes, to link them to other nodes, with more gizmo code to draw lines between them, Or a menu editor script, to auto to ray casts to try and auto generate lists of connected nodes. For A* you can find lots of code by googling, or buy one from asset store and modify it to your needs. The 'Cost' of traversing a connection between nodes, is typically just the distance, unless you want the Ai to avoid certain routes... say, crossing water, or fire is more costly, then add cost multipliers to node connections. Hope this is helpful... sorry its a very general question you are asking.... could be a very long answer.