Hey, I am trying to make the mouse control the camera’s rotation, but instead of sliding around the pivot point, it snaps around the pivot point, from one location to another, much like its teleporting, my script is below :-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class camcontrol : MonoBehaviour
{
public float rotationX;
public float sensitivity = 500f;
public float mouseY;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
mInput();
}
void FixedUpdate()
{
camRot();
}
void mInput()
{
//Taking input
mouseY = Input.GetAxis("Mouse Y") * sensitivity;
}
void camRot()
{
//Rotate Cam up and down
rotationX -= mouseY;
rotationX = Mathf.Clamp(rotationX, -90f, 90f);
transform.localEulerAngles = new Vector3(rotationX, 0f, 0f);
}
}