Originally just used a NavAgent so the follower would use pathfinding to follow the player. Nothing fancy, just got the job done for basic demonstration purposes.
Attempt 1: State Machine similar to the player. Rather illogical given that they are only following the player and the battle map handles most of those actions.
Attempt 2: Rewrite the NavAgent to be more sophisticated in how it handles pathfinding and what to do when it gets too close or too far from the player, also flipping between face_left and face_right appropriately.
With my attempt to use the State Machine, upon map loading, the player would suddenly get launched into the abyss for unknown reasons. Going back to the NavAgent basically solved that problem, but then it seemed to think that the follower was loading in before the NavMesh it would use to calculate distances etc., so it wouldn't do anything but throw errors. It would, however, continue to flip the follower face_left or face_right as appropriate.
Get frustrated, decide to go back to the nice, safe, easy code I had at the beginning, the non-flipping NavAgent I've been utilizing so far.
It no longer works.
I changed nothing in the NavMesh. I changed nothing in the player. This was the NavAgent that has been working and doing just fine for weeks. Now it doesn't work.
0 comments