How to move character based on tiles direction?

Hi. I’m new to unity and I have a question regarding on how to make my character to walk on a path. Here’s the scenario:

I have a game board (similar to Jumanji except its modified so only 1 player could play - means only 1 start point instead of 4) and I want my player to walk on the board tiles. I enabled Y and Z axis for my character movements. I want my character to auto rotate based on the tile direction (in other words, move on a pre-defined path along Z axis).

How do I achieve this? Using pathfinding? Any hint is very much appreciated as I am lost in finding my way. :face_with_spiral_eyes:

Thanks.

Simplest way to do this would be to use Transform.LookAt.

Just remember to set the value you use for that for whatever axis you’re not using for movement to your current position on that axis, or the character’s gonna end up looking down toward the tiles or something.

Movement in that direction can be done with a character controller, and since you’re already looking in that direction, you’d just use transform.forward multiplied by however fast you want to move and Time.deltatime.

Seeing as you’re using a game board, you’d just need to set it to rotate toward the next tile, walk in that direction until the position’s at or close to the middle of the tile, rotate toward the next one, rinse and repeat. Since you say you already have a pre-defined path, you’d just need to record where all of the tiles on the path are and Presto!

Thank you very much. I think I finally have a clearer view on how to achieve this. Will try it out.