一款能让Vive开发变得简单的插件——Vive Input Utility API详解

相信各位小伙伴们在使用SteamVR Unity Plugin的过程中应该都遇到过这样的问题:获取设备很麻烦,设备在重启后indexID会改变从而导致设置好的左右手设备出现交错;无法与UGUI的事件系统连接导致无法使用UGUI等等很多问题。(见图1) 
        官方推出Vive Input Utility Unity Plugin,解决了以上的一些问题,为大家的开发提供了很好的便利。大家可以在Unity AssetStore中下载到,https://www.assetstore.unity3d.com/cn/#!/content/64219 。 
本插件的联络邮箱为 vivesoftware@htc.com,如果有问题可以通过这个邮箱反馈。 

我们会推出Vive Input Utility使用教程系列, 
第一篇:Vive Input Utility的使用指南 https://www.htcvive.com/cn/forum/chat.php?mod=viewthread&tid=1708&extra=page%3D1 
第二篇:Vive Input Utility API详解 https://www.htcvive.com/cn/forum/chat.php?mod=viewthread&tid=1720&extra=page%3D1 
第三篇:Vive Input Utility手把手教程https://www.htcvive.com/cn/forum/chat.php?mod=viewthread&tid=1728&extra=page%3D1 

API详解: 
uint ViveRole.GetDeviceIndex(DeviceRole role) 
        返回由role确定的设备的设备索引,如果role没有分配任何设备的话返回OpenVR.k_unTrackedDeviceIndexInvalid。 
bool VivePose.HasFocus() 
        返回true,如果当进程正在运行。通常当玩家按下手柄上菜单按钮切换到steam菜单面板时,进程切换到后台。 
bool VivePose.IsConnected(DeviceRole role) 
        如果由role定义的设备被连接了返回true 
bool VivePose.HasTracking(DeviceRole role) 
        如果由role定义的设备的追踪数据有有效值的时候返回true 
Pose VivePose.GetPose(DeviceRole role, Transform origin = null) 
        返回由role定义的设备的追踪pose 
void VivePose.SetPose(Transform target, DeviceRole role, Transform origin = null) 
        设置目标pose来追踪由role定义的设备的相对于origin的pose 
bool ViveInput.GetPress(HandRole role, ControllerButton button) 
        当控制器上的按钮被按了的时候返回true 
bool ViveInput.GetPressDown(HandRole role, ControllerButton button) 
        当控制器上的按钮被按下的时候返回true 
bool ViveInput.GetPressUp(HandRole role, ControllerButton button) 
        当控制器上的按钮被松开的时候返回true 
float ViveInput.GetTriggerValue(HandRole role) 
        返回扳机键的原始的模拟量 
Vector2 ViveInput.GetPadAxis(HandRole role) 
        返回touchpad上的原始模拟量 
int ViveInput.ClickCount(HandRole role, ControllerButton button) 
        返回按钮连续点击的次数。查看ViveInput.clickInterval来获取点击间隔时间 
float ViveInput.LastPressDownTime(HandRole role, ControllerButton button) 
       返回用户按下按钮的最后一帧的时间 
void ViveInput.AddPress(HandRole role, ControllerButton button, Action callback) 
void ViveInput.AddPressDown(HandRole role, ControllerButton button, Action callback) 
void ViveInput.AddPressUp(HandRole role, ControllerButton button, Action callback) 
void ViveInput.AddClick(HandRole role, ControllerButton button, Action callback) 
void ViveInput.RemovePress(HandRole role, ControllerButton button, Action callback) 
void ViveInput.RemovePressDown(HandRole role, ControllerButton button, Action callback) 
void ViveInput.RemovePressUp(HandRole role, ControllerButton button, Action callback) 
void ViveInput.RemoveClick(HandRole role, ControllerButton button, Action callback) 
        添加和移除press、pressdown、pressup、click的监听事件 
void ViveInput.TriggerHapticPulse(HandRole role, ushort intensity = 500) 
        控制器上扳机的震动 


本帖最后由 Shengjie Zhang 于 2016-8-31 10:18 编辑 


本帖最后由 Shengjie Zhang 于 2016-8-31 10:21 编辑 


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值