Answer the question
In order to leave comments, you need to log in
Due to Time.deltatime, the player's movement distance is not controlled, what should I do?
Hello! I'm making a game and I need the character to move smoothly on the grid, I made the following code
public float Speed;
private Rigidbody2D _rigibody2D;
void Start()
{
_rigibody2D = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.S)) {
transform.Translate(new Vector2(0.0f , -Speed * Time.deltaTime));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question