Hello, I’ve been trying to create a script for my Tile Based movement game where the Player moves to a selected destination tile when you click on it, and it navigates to it via Dijkstra pathfinding. The problem I have it that instead of moving directly from the start tile to the end tile at a constant speed, it stops at each tile in the path until it reaches the destination. Furthermore, it moves incredibly quickly wheras I want it to move at a speed that I choose but for some reason that is not working. Here is a segment of my script with movement Lerp.
float i = 0.0f;
float rate = 1f / 0.001f;
if (i < 10f) {
i += Time.deltaTime * rate;
if (Vector3.Distance (transform.position, map.TileCoordToWorldCoord (tileX, tileZ)) < 0.001f)
AdvancePathing ();
transform.position = Vector3.Lerp (transform.position, map.TileCoordToWorldCoord (tileX, tileZ), i);
Any help would be greatly appreciated.