- Home /
How can I move the A* Pathfinding Grid Graph with the camera in a endless runner game?
I'm using the Pathfinding script for the Enemy to find my player, the issue is: the game is a endless runner and I'm looking for workarounds to make the Grid Graph keep together with the camera, because the enemy stop to pursuit the player after the limit of Grid Graph(line blue). The yellow mark is the camera, so how I can move the Grid Graph?
Answer by lgarczyn · Oct 04, 2019 at 09:29 PM
There are two possibilities.
First possibility would be to have a very large grid graph, that is rebuilt every time you get close to its end.
Simply move the camera, player, environment and enemies back to 0, and rebuild it.
This allows you to keep most of your logic the same
The other solution is to call relocateNodes every frame, which basically slides everything inside the GridGraph to a new position. This simply requires you to keep your Camera on 0, and move everything else.
Your answer
![](https://koobas.hobune.stream/wayback/20220612212938im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I make the EnemyBullet go further than my target? 0 Answers
Character Controller problem 0 Answers
Unity Default character 2 Answers
3D flying enemy pathfinding,3D flying pathfinding? 0 Answers
Player or character select 2 Answers