December 19, 2019
A* Pathfinding
2D Conversion
ISSUES
Pathing In Circles Away from Target
They move in a large circle around the entire game area. They go in a half circle consistenly then stop in about the same place everytime (either directly above or below the middle of the play area).
Test 1: Tone Values Down
I tried toning all their numbers down since my game area is relatively small in case they were just constantly over shooting node targets, but this did not change the behavior.
I think the direction I am aiming and moving them must be incorrect with how I changed the Vector math from 3D to 2D.
DETERMINED ISSUE
They can only respond to the player’s X position. If the player moves, the properly oriented ones will move slightly to keep at the same X value, whereas those facing the other direction will travel in a large circle to reach the same X value (since I guess they cannot rotate very easily).
Test 2: Edit Rotation Calculation
I just needed to remove an extra (-90) that was being applied to the rotation vectors for aiming them at the target. This completely fixed the issue for their initial movement, but they only move in the x direction after that initial reaching of the target now.
DETERMINED ISSUE
The target position is not changing its Y value for some reason, only its X value.
Next Steps
Either their rotation is messed up (so moving right only moves them along x axis) or the overall translation is messed up and is only moving them left and right. It could be another z/y conversion error somewhere.
Test 3: Change NodeFromWorldPoint Method to Use worldPosition.y instead of z
It looks like PathFindingHeap was using AGrid NodeFromWorldPoint function to determine the proper node from world points, but this was using the z value of the Vector3 input as to determine the y coordinate in the overall grid. This is why it was constantly hovering at the same low Y value, because those were the nodes that correlated with a z input of 0.
SOLVED
These combined edits fixed the pathfinding logic completely. They now constantly followed the target position properly and it updated accordingly.