Quaternion.Lerp и Quaternion.Euler не работают вместе.
Пытаюсь сделать свободный обзор мышкой и наклоны клавишами.
float mouseX = Input.GetAxisRaw("Mouse X") * 2.0f;
float mouseY = Input.GetAxisRaw("Mouse Y") * 2.0f;
yRotation += mouseX;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
if (Input.GetButton("PeakLeft"))
{
playerCamera.transform.position = Vector3.Lerp(playerCamera.transform.position, leftPeak.position, 0.35f);
playerCamera.transform.rotation = Quaternion.Lerp(playerCamera.transform.rotation, leftPeak.rotation, Time.deltaTime * Rotation_Smoothness);
}
if (Input.GetButton("PeakRight"))
{
playerCamera.transform.position = Vector3.Lerp(playerCamera.transform.position, rightPeak.position, 0.35f);
playerCamera.transform.rotation = Quaternion.Lerp(playerCamera.transform.rotation, rightPeak.rotation, Time.deltaTime * Rotation_Smoothness);
}
playerCamera.transform.rotation = Quaternion.Euler(xRotation, yRotation, playerCamera.transform.rotation.z);
И из за playerCamera.transform.rotation = Quaternion.Euler(xRotation, yRotation, playerCamera.transform.rotation.z);
Quaternion.Lerp перестает работать в пиках.