rb2d.MovePosition(rb2D.position + velocity * Time.fixedDeltaTime);
will move the player constantly. However, I would like the player to move a certain distance in a certain direction when the left arrow key is pressed, as if they have teleported to the new position. I can do it with transform.translate, but this means it won’t work with collisions. Any idea how I can do this with Rigidbody2d.MovePosition? ?
I have tried:
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
rb2D.MovePosition(rb2D.position + velocity * Time.fixedDeltaTime);
}
But that doesn’t result in movement
Thanks!