Answer the question
In order to leave comments, you need to log in
What is the best way to find a path in Unity?
Given: 2D game, endless plane with obstacles.
Task: Teach AI to pass from point A to point B along the optimal trajectory. With obstacle avoidance of course.
Google tells me that NavMesh does not work in 2D, it is suggested to use the self-written version of A*. It confuses me that A* and its alternatives are graph algorithms, i.e. First, I will need to plot the nodes of the graph on the map. And since the destination and obstacles can move, the graph and nodes will need to be rebuilt every Update of my AI. All this seems dubious in terms of performance. Yes, and I don’t want to spend time writing a bicycle.
Answer the question
In order to leave comments, you need to log in
What prevents to do in 3d? You fix the camera from the right angle and here's a pseudo 2d for you. This is usually easier and faster. Unity is primarily a 3d engine and, accordingly, more functional when working in 3d. And there it’s up to the small, turned the objects into the desired plane, cut out the shadows, etc.
If it's important to do it in 2d, then it seems to me possible through the direction vector and raycasts, but if it's something like a labyrinth... maybe add waypoints.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question