- Home /
Question by
Sphixcraft · Jul 19, 2020 at 07:46 AM ·
c#cameramathf
Why does it bug when i want to rotate my camara
My Camara bugs when i want to smooth rotation
float mouseX = Input.GetAxis("Mouse X") * sensitivity * Time.fixedDeltaTime * sensMultiplier;
float mouseY = Input.GetAxis("Mouse Y") * sensitivity * Time.fixedDeltaTime * sensMultiplier;
//Find current look rotation
Vector3 rot = playerCam.transform.localRotation.eulerAngles;
desiredX = rot.y + mouseX;
//Rotate, and also make sure we dont over- or under-rotate.
xRotation -= mouseY;
// xRotation = Mathf.Clamp(xRotation, -90f, 90f);
//Perform the rotations
newPosition = Mathf.SmoothDamp(playerCam.transform.rotation.z, desiredSmoothz, ref zVelocity, smoothTime);
playerCam.transform.rotation = Quaternion.Euler(xRotation, desiredX, newPosition);
Debug.Log(newPosition +"Smoothed");
Debug.Log(desiredSmoothz +"Not Smoothed");
orientation.transform.localRotation = Quaternion.Euler(0, desiredX, 0);
Comment