25 lines
553 B
C#
25 lines
553 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraControllerY : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private float mouseSpeed = 500f;
|
|
|
|
private float pitch = 0f;
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
float mouseY = Input.GetAxis("Mouse Y");
|
|
|
|
pitch -= mouseY * mouseSpeed * Time.deltaTime;
|
|
|
|
pitch = Mathf.Clamp(pitch, -90f, 30f);
|
|
|
|
transform.localRotation = Quaternion.Euler(pitch, 0f, 0f);
|
|
|
|
}
|
|
}
|