I’m making a 2D tower defense game and I need the enemies to always walk on the center of each node on the grid.
I’m currently using AI Lerp and it gives me this path:
Original Path
I’ve managed to correct it by creating a modifier that always returns the center of the node(substitutes the decimal part for 0.5, example: 1.3 -> 1.5) using this algorithm, and now it follows the correct path:
Corrected Path
But now it snaps like crazy, specially on turns. I’ve tried using pretty much every type of smooth modifier but it didn’t really help.
Is there a recommended way of doing this? Either way would work for me, smoothing the path or recalculating a better one.
Thanks.