- Home /
Question by
francisco_simoes · May 25, 2019 at 09:30 PM ·
c#cameraquaternioncamera rotatelean
Rotate Camera/Leaning
Hey guys, currently having a huge issue with camera rotations. By far my least comfortable topic as of right now. Im trying to make a peaking system and iv been following several diferente people online, unfortunately, iv hit my road block. Anyone able to tell me why my camera does not rotate?
void LeanInput() { if (Input.GetKey(leanLeft)) { SetRotateZ(-amount); } } void SetRotateZ(float value) { rotateZ = value; Quaternion leanedRot = Quaternion.Euler(cameraTargetRot.eulerAngles.x, cameraTargetRot.eulerAngles.y, rotateZ); cameraTargetRot = Quaternion.Lerp(cameraTargetRot, leanedRot, Time.deltaTime * 2); }
If anything is missing please let me know, id be really happy to recieve some guidance.
Comment
Answer by EternalClickbait · May 25, 2019 at 11:32 PM
Off the top of my head so don't trust me 100% on this
The Z axis doesn't rotate from side to side (shaking head). It tilts the head (think of falling on to your left/right side). If you want to rotate the camera from left to right, rotate around the Y axis