Hello everyone, I seem to be having issues with my first Person Camera. What I’m currently working on has two camera modes, one that is overhead where the camera simply follows the player(no player input will modify this camera) and another that changes the camera to a first person point of view, both each with their camera game object on the scene. I have my first person camera controller on a separate script than the the regular player controller and everything seems to be working fine, only that the Z rotation of the camera keeps moving with every input of my controller’s right stick(dualshock 4). My question is is there any way to freeze this camera’s Z rotation? Thanks, and if any other type of information is needed I will gladly provide!
(PS: This is my first post on the forums so my apologies if thing seem a little noob-ish.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FPCam : MonoBehaviour {
public float sens;
private Vector3 camRotation;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
camRotation = new Vector3(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"), 0f) * sens;
transform.Rotate(camRotation);
}
}