获取鼠标3个键的响应如下:
鼠标左键GetMouseButton(0)
鼠标右键GetMouseButton(1)
鼠标中键GetMouseButton(2)
只要在MouseLook.cs中的Update()的相应位置加上Input.GetMouseButton(1)就可以了。
以下为全部内容
using UnityEngine;
using System.Collections;
/// MouseLook rotates the transform based on the mouse delta.
/// Minimum and Maximum values can be used to constrain the possible rotation
/// To make an FPS style character:
/// - Create a capsule.
/// - Add a rigid body to the capsule
/// - Add the MouseLook script to the capsule.
/// -> Set the mouse look to use LookX. (You want to only turn character but not tilt it)
/// - Add FPSWalker script to the capsule
/// - Create a camera. Make the camera a child of the capsule. Reset it's transform.
/// - Add a MouseLook script to the camera.
/// -> Set the mouse look to use LookY. (You want the camera to tilt up and down like a head. The character already turns.)
[AddComponentMenu("Camera-Control/M
最好用Unity3D按住鼠标键才转动摄像机的方法
最新推荐文章于 2024-04-26 15:30:33 发布