- Home /
Move camera relative to current position
Hello,
I am using the folowing script to move the camera (in the vertical direction)
RotPitch -= Input.GetAxis ("Mouse Y") * msensitivity;
Camera.main.transform.localRotation = Quaternion.Euler (RotPitch, 0, 0);
The problem with this is that it ignores the current position of the Camera. As I am using a mouselook function during shooting (so that the cursor locks on the target) this gives problems when switching from lookat to the above script.
I would like to know how to solve this.
Comment
This might work:
Rot$$anonymous$$ch = Input.GetAxis ("$$anonymous$$ouse Y") * msensitivity;
Camera.main.transform.localRotation = Quaternion.AngleAxis(Rot$$anonymous$$ch, transform.right) * Camera.main.transform.localRotation;
Your answer
Follow this Question
Related Questions
Using MouseLook script with LookAt function 2 Answers
Make Prefab Look At Target 2 Answers
How to execute the lookAt function here? 1 Answer
Camera follow in c# 1 Answer
How to rig a cutscene Camera back to it's original place 1 Answer