Question by
leenffc · Jan 25, 2018 at 02:14 PM ·
rotationcamera rotatemathf.lerp
Look rotation reset back to center (lerp)
Hey Guys,
I have this script. Which rotates my camera (up and down) depending on input from a joystick
rotationX -= CnInputManager.GetAxis ("Mouse X") * sensitivityX;
// clamp the max and minimum rotation of camera's X rotation
rotationX = Mathf.Clamp(rotationX, minimumX, maximumX);
//Rotate the player camera
playerCamera.transform.localRotation = Quaternion.Euler (rotationX, 0, 0);
This part works fine. But i want to try and reset the camera back to 0 rotation after the player has stopped moving around (Snap back to 0)
so I tried this,
rotationX = Mathf.Lerp(rotationX, 0, camResetSpeed * Time.deltaTime);
This does the job, But ive noticed that I cannot move the camera to its full clamp rotations anymore. For example is minimum X was 5. Now it will only go upto a maximum of around 4.
Comment