hey guys. i got this script for my character to follow the mouse to the left and to the right.
public float turnSpeed = 15;
Camera mainCamera;
// Start is called before the first frame update
void Start()
{
mainCamera = Camera.main;
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
// Update is called once per frame
void FixedUpdate()
{
float yawCamera = mainCamera.transform.rotation.eulerAngles.y;
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(-90f, yawCamera+180f, -65f), turnSpeed * Time.fixedDeltaTime);
}
}
if i try the same for up and down it doesnt work. i just have to rotate the x axis of the obect.anywone can help me?