using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Main : MonoBehaviour
{
public float speed;
private float yCout;
private float yLastCout;
// Start is called before the first frame update
void Start()
{
Debug.Log("开始");
}
// Update is called once per frame
void Update()
{
//Debug.Log("循环");
if (Input.GetMouseButton(0))
{
//Debug.Log("按下鼠标");
float xValue = -speed * Input.GetAxis("Mouse X");
float yValue = speed * Input.GetAxis("Mouse Y");
yCout += yValue;
yCout = Mathf.Clamp(yCout, xMinLimit, xMaxLimit);
float realYValue = yCout - yLastCout;
transform.Rotate (Vector3.up, xValue);
transform.Rotate (Vector3.right, realYValue, Space.World);
yLastCout = yCout;
}
}
}