Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CameraController : MonoBehaviour
- {
- public Transform target;
- private float xRot;
- public float mouseSensitivityX = 100f;
- public float mouseSensitivityY = 100f;
- public Transform cam;
- // Start is called before the first frame update
- void Start()
- {
- }
- private void Update()
- {
- transform.Rotate(Vector3.up * Input.GetAxis("Mouse X")* mouseSensitivityX * Time.deltaTime);
- xRot -= Input.GetAxis("Mouse Y") * mouseSensitivityY * Time.deltaTime;
- xRot = Mathf.Clamp(xRot, -10, 15);
- cam.localRotation = Quaternion.Euler(xRot, 0, 0);
- }
- // Update is called once per frame
- void LateUpdate()
- {
- transform.position = target.position;
- //transform.rotation = target.rotation;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement