Hi! I use the following code to move the object: RB.velocity = new Vector2(Input.GetAxis("Vertical") * 4f, RB.velocity.y); in FixedUpdate()
please tell me how to limit the movement of an object by condition. The fact is that when I use an if, for example: if (Input.GetKey(KeyCode.A)) { RB.velocity = new Vector2(Input.GetAxis("Horizontal") * 6f, RB.velocity.x); }
the object starts to move diagonally, not horizontaly.