- Home /
Sidescroller AI/Pathfinding/Flags/Waypoints
I'll start off by saying I've never done complex A* and the little I've done's in NetLogo (yep).
Currently working on a wee 2D Sidescroller game and I need my NPCs to "aggro" the player (taken care off), target the player with avoidable projectiles (also taken care off) and chase after the player traversing complicated terrain (platforms, stairs, pits).
On to the point:
Any suggestions on what I could use to get my NPCs to follow the player (I'm assuming waypoints and flags) accurately and any suggestions on a source where I can read up a bit more regarding the subject. Assuming waypoints, how do I find the closest waypoint to the player (assuming I know the player's position) without checking every individual waypoint (Only keep waypoints in screen space enabled maybe?).
Thanks for any advice coming forth :).
hi, sorry if i'm going out of the point a little, but have you checked navmesh-es?
https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/navmeshes https://unity3d.com/learn/tutorials/modules/beginner/navigation/navmesh-agent
i haven't used them, so i can't recommend it or not, but that might be doing the trick for you and avoid some work.
hope it helps.
You should take a look at Vector3.Distance to find the closest waypoint to the player. And about chasing the player use navmesh, there's a great tutorial in the Learn section, Survival Shooter They use it there, cool tutorial try and watch
Alright boys I just got back from work, I'll make sure I take a look at the suggested stuff :P