Character Movement

Hello there,

In my project i have a character, my character need to move based upon the value like Chess ,Mr.Ludo or anyother board game, because the board has a end, so my character don’t go through the board, for that i don’t want a default controller. So i need to put my own code. if anyone know the logic let me know please.

-Prasanna

The “dice movement” portion implies that your character is moving in increments of 1?

Then you probably want to implement a tile structure for you gameboard, if you not have done yet.

A good place to start are the tutorials mentioned here

After you have a working tile structure you can easily check if the next step forward is a valid move, and if not, rotate the character to move in a perpendicular direction.

If you have any further question, dont hesitate to ask. If you want to do your thing (NOT RECOMMENDED) without board tiles, just ask.

how about you find the length of one tile, and multiply the tile length by the dice value, and move it that far forward on the z axis? Something like

this.transform.position.z = tileLength * diceValue;

then you want them to turn if they reach the last row so

for (int i; i = 0; i < diceValue; i++) {
    this.transform.position.z += tileLength;
    if (this.transform.position.z >= lastRowPosition) {
        //code for rotating to the right, I'm too lazy to look it up
    }
}

you can use that OR you can increment it each Update, and put a box collider above the last row, and use

function OnTriggerEnter() {
    //rotate person 90 degrees
}