- Home /
Camera keeps its rotation when switching cameras
So I have a Two cameras attached to the player, A first person and a third person camera, and I have a script that switches between theme. But the problem is when the player switches from the FP camera to the TP one, the TP camera's rotation doesn't follow the FP's rotation. And here are the two scripts I'm using: This is the script I'm using on both cameras: void Start () {
character = this.transform.parent.gameObject;
}
void Update () {
var md = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
md = Vector2.Scale(md, new Vector2(sensivity * smoothing, sensivity * smoothing));
smoothV.x = Mathf.Lerp(smoothV.x, md.x, 1f / smoothing);
smoothV.y = Mathf.Lerp(smoothV.y, md.y, 1f / smoothing);
mouseLook += smoothV;
mouseLook.y = Mathf.Clamp(mouseLook.y, -minY, maxY);
transform.localRotation = Quaternion.AngleAxis(-mouseLook.y, Vector3.right);
character.transform.localRotation = Quaternion.AngleAxis(mouseLook.x, character.transform.up);
}
I'm also using a standard assets prefab. Can you help please?
Your answer
Follow this Question
Related Questions
Camera Rotating when the player reach a specific position 0 Answers
Need help to make the camara rotation follow the player 0 Answers
First person camera- Limit X-axis rotation.,How to Limit Camera rotation on X-Axis 0 Answers
3rd Person Camera,How would I make it so that the character will turn the way of the camera? 0 Answers
Drop down menu trigger'd cutscene 0 Answers