vive手柄按键获取
来源:互联网 发布:国语版港剧软件 编辑:程序博客网 时间:2024/06/09 17:39
using System.Collections;using System.Collections.Generic;using UnityEngine;public class UserViveHand : MonoBehaviour{ public SteamVR_TrackedObject Hand; private SteamVR_Controller.Device device;void Start (){ Hand = GetComponent<SteamVR_TrackedObject>();}// Update is called once per framevoid Update () { device = SteamVR_Controller.Input((int)Hand.index); // 按下了扳机按钮调用 if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger)) { Debug.Log("trigger"); } if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger)) { Debug.Log("PressDown"); } if (device.GetPressUp(SteamVR_Controller.ButtonMask.Trigger)) { Debug.Log("PressUp"); } // 当手放置在触摸圆盘上的时候调用 if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad)) { Debug.Log("touchpad"); // 获取触摸板上的坐标 Vector2 pad = device.GetAxis(); Debug.Log("按下了" + pad); // 转换角度 Vector3 cross = Vector3.Cross(new Vector2(1, 0), pad); float angle = Vector2.Angle(new Vector2(1, 0), pad); float ang = cross.z > 0 ? -angle : angle; Debug.Log(ang); } // 按下面板的时候打印 if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Axis0)) { Debug.Log("Axis0"); } // 按下扳机键的时候打印 if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Axis1)) { Debug.Log("Axis1"); } //左手震动 var device1 = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Leftmost); SteamVR_Controller.Input(device1).TriggerHapticPulse(2000); // 获取左右手柄的标志 var device2 = SteamVR_Controller.GetDeviceIndex(SteamVR_Controller.DeviceRelation.Rightmost); // 设置获取手柄的震动值 SteamVR_Controller.Input(device2).TriggerHapticPulse(100); if (device.GetTouchDown(SteamVR_Controller.ButtonMask.ApplicationMenu)) { Debug.Log("你按下了菜单键"); } //抓握按键手柄左右两侧的抓握按键为一个按键 if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Grip)) { Debug.Log("你正紧握"); } if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Grip)) { Debug.Log("你松开了"); } }}
阅读全文
0 0
- vive手柄按键获取
- vive手柄按键开发说明
- HTC vive开发:关于手柄按键
- HTC vive开发:关于手柄按键
- HTC vive开发:关于手柄按键对接控制
- HTC vive开发:关于手柄按键对接控制
- Unity HTC VIVE 手柄 接入(手柄上的按键都有说明)
- Unity HTC VIVE 手柄 接入(手柄上的按键都有说明)
- Unity HTC VIVE 手柄 接入(手柄上的按键都有说明)
- HTC VIVE 手柄 接入(手柄上的按键都有说明)
- Unity HTC VIVE 手柄 接入(手柄上的按键都有说明)
- 获取游戏手柄的按键输入
- UE4 vive手柄震动
- Vive手柄按钮
- Unity的HTC VIVE SDK研究(手柄按键功能的研究,比较详细)
- Unity的HTC VIVE SDK研究(手柄按键功能的研究,比较详细)
- vive 手柄的Grab Mechanics
- HTC-VIVE手柄使用代码
- ConnectivityManager类 判断网络是否可用进行设置
- tesseract4.0alpha、leptonica-1.74.4编译和安装
- 关于前端的一些禁止操作
- tabview中有输入框监听键盘事件
- sql语句中where 1=1 的用法
- vive手柄按键获取
- 计算图片中的物体的实际尺寸的一种方法
- LCD显示移植(LVDS接口)
- 十四,I/O
- 小数后保留两位小数
- 利是说小程序怎么开发
- 补间动画的实现
- 01背包问题
- 每日一则JavaWeb---spring的<util:> 和<p:>