- Home /
How to move the player 1 in 1?
I have a question about moving the player always 1 in 1.
It would be a system of movement as in the game Tibia, where each square of the Unity was a possible square to move.
the player would always move 1 in 1 "square" without extrapolating that "square" with a certain speed.
The center of the square is x = 0.5 and y = 0.5, the transform.position.x or y would always vary by 1 regardless of velocity, speed only changes the time it crosses from one square to another "square ".
Answer by xxmariofer · Jan 14, 2019 at 09:44 PM
Hello, you can use the Transform.MoveTowards method and increase a vector 3 in a direction example:
tranform.position = Transform.Movetoward(transform.position, nextposition, speed);
//when the player moves to next block increase nextposition by one
nextposition += Vector3.right;
Your answer
Follow this Question
Related Questions
how can I make an animation play on keypress but stop on release? 2 Answers
Animation clips anyone? 1 Answer
Game freeze while passing from Idle to any other animation...? 0 Answers
Animation Won't Start 3 Answers
Walking & Gravity 2 Answers