标签:escape 初始化 bsp 而且 tar down inf get 插件
尝试过AS转写手柄监听、incontrol插件,最终没能实现。手柄型号:SP3/PC。
经过一夜奋战,通过https://blog.csdn.net/lengyoumo/article/details/91386404文章指示,
在edit ->projectsettings->input->axes中设定
type 选择joystick axis
axis 选择 x axis 和 y axis 。分别对应 horizontal 和 vertical。
如果手柄有多个摇杆,需要修改name和 axis。
修改了Dead、Sensitivity的值,不然转的头晕,速度太快,而且人物不停的朝一个方向转。。。把Vertical做了镜像(invert),好像这个轴跟U3d的3rdCControler方向是反的。Horizontal就不用了。
通过https://blog.csdn.net/cordova/article/details/51036547的方法进行了测试,目前代码如下:
public class TVInput : MonoBehaviour { public Text KeyCodeText; //显示按键状态的text文本 public Text KeyCodeText1; private bool isOk; //确定键按下状态 // 初始化 void Start() { isOk = false; } // 按帧刷新检测 void Update() { //监听按键事件: //*** 按下 ***// //左 if (Input.GetKeyDown(KeyCode.LeftArrow)) { isLeft = true; KeyCodeText.text = "左键按下"; } //右 if (Input.GetKeyDown(KeyCode.RightArrow)) { isRight = true; KeyCodeText.text = "右键按下"; } //上 if (Input.GetKeyDown(KeyCode.UpArrow)) { isUp = true; KeyCodeText.text = "上键按下"; } //下 if (Input.GetKeyDown(KeyCode.DownArrow)) { isDown = true; KeyCodeText.text = "下键按下"; } //返回 if (Input.GetKeyDown(KeyCode.Escape)) { isBack = true; KeyCodeText.text = "返回键按下"; } //回车 if (Input.GetKeyDown(KeyCode.JoystickButton0)) //A { isOk = true; KeyCodeText.text = "JoystickButton0按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton1)) //B { isOk = true; KeyCodeText.text = "JoystickButton1按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton2)) //X { isOk = true; KeyCodeText.text = "JoystickButton2按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton3)) //Y { isOk = true; KeyCodeText.text = "JoystickButton3按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton4)) //L1 { isOk = true; KeyCodeText.text = "JoystickButton4按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton5)) //R1 { isOk = true; KeyCodeText.text = "JoystickButton5按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton6)) //L2 { isOk = true; KeyCodeText.text = "JoystickButton6按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton7)) //R2 { isOk = true; KeyCodeText.text = "JoystickButton7按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton8)) //左摇杆 { isOk = true; KeyCodeText.text = "JoystickButton8按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton9)) //右摇杆 { isOk = true; KeyCodeText.text = "JoystickButton9按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton10)) //START { isOk = true; KeyCodeText.text = "JoystickButton10按下"; } if (Input.GetKeyDown(KeyCode.JoystickButton11)) //SELECT { isOk = true; KeyCodeText.text = "JoystickButton11按下"; } } }
在电视端测试通过。
Stationary Turn Speed 减到20,这转速还是太快。
标签:escape 初始化 bsp 而且 tar down inf get 插件
原文地址:https://www.cnblogs.com/guaike01/p/13245745.html