Hello, I have a problem with the code. The problem is when I press either on left/right of the screen the character doesn’t rotate smoothly, but I also have a code where you press “A” or “D” and the character rotates smoothly. Can someone help me understand what I am doing wrong please?? My code:
transform.Rotate(0, 0, Input.GetAxis("Horizontal") * rotateSpeed);
if (Input.GetMouseButton(0))
{
if (Input.mousePosition.x > Screen.width / 2)
transform.Rotate(0, 0, -rotateSpeed);
else
transform.Rotate(0, 0, rotateSpeed);
}
transform.rotation = Quaternion.Lerp(transform.rotation, transform.rotation, rotateSpeed * Time.deltaTime);
Thank you for you time