Well I am currenty programming a 2D game in Unity. I have a Player which you can rotate to the left or to the right with the arrow keys. If you press the right arrow key the player should rotate right and if you press left arrow key the player should rotate to the left. Right now if the player press left arrow key it rotates right and if right is pressed it rotates to the left. This is my Code:
private void RotatePlayer()
{
float horizontal = Input.GetAxisRaw("Horizontal");
float rotation = horizontal * speed;
transform.Rotate(Vector3.forward * rotation);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…