最近在做的FPS刚好用到 顺带就解释了下
using UnityEngine;
using System.Collections;
// MouseLook rotates the transform based on the mouse delta.
// To make an FPS style character:
// - Create a capsule.
// - Add the MouseLook script to the capsule.
// -> Set the mouse look to use MouseX. (You want to only turn character but not tilt it)
// - Add FPSInput script to the capsule
// -> A CharacterController component will be automatically added.
//
// - Create a camera. Make the camera a child of the capsule. Position in the head and reset the rotation.
// - Add a MouseLook script to the camera.
// -> Set the mouse look to use MouseY. (You want the camera to tilt up and down like a head. The character already turns.)
[AddComponentMenu("Control Script/Mouse Look")]//设置脚本路径
public class MouseLook : MonoBehaviour
{
public enum RotationAxes
{ //枚举坐标轴
MouseXAndY = 0,
MouseX = 1,
MouseY = 2
}
publi