本文实例为大家分享了团结实现人物旋转和移动的具体代码,供大家参考,具体内容如下
<>强旋转强>
使用System.Collections; 使用System.Collections.Generic; 使用UnityEngine; 公共类MouseLook: MonoBehaviour { 公共enum RotationAxes { MouseXandY=0, MouseX=1, 像老鼠的=2 } 公共RotationAxes轴=RotationAxes.MouseXandY; 公共浮动sensitivityHor f=9.0; 公共浮动sensitivityVert f=9.0; 公共浮动minVert f=-45.0; 公共浮动maxVert f=45.0; 私人浮动_rotationX=0;//用它来初始化 无效的Start () { Rigidbody身体=GetComponent(); 如果(身体!=null) { body.freezeRotation=true; } }//更新叫做> 使用System.Collections; 使用System.Collections.Generic; 使用UnityEngine; [RequireComponent (typeof (CharacterController))]//如果对象没有该组件,则创建一个 [AddComponentMenu(“控制脚本/FPS输入”)]//可以在添加组件查到 公共类FPSInput: MonoBehaviour { 私人CharacterController _characterController; 公共漂浮速度f=10.0; 公共浮子重力f=-9.8;//用它来初始化 无效的Start () { _characterController=GetComponent ();//获取对象里的某一组件 }//更新叫做alt="团结实现人物旋转和移动效果”> ![]()
父容器比较小,人物到达边缘
![]()
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持只
团结实现人物旋转和移动效果