首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

【Unity+Vive】第二篇:Vive Input Utility API详解

  • 25-03-07 22:22
  • 4490
  • 6112
blog.csdn.net

修改了图片位置。

原链接:

https://www.htcvive.com/cn/forum/chat.php?mod=viewthread&tid=1720

 

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

相信各位小伙伴们在使用SteamVR Unity Plugin的过程中应该都遇到过这样的问题:获取设备很麻烦,设备在重启后indexID会改变从而导致设置好的左右手设备出现交错;无法与UGUI的事件系统连接导致无法使用UGUI等等很多问题。(见图1) 


        
官方推出Vive InputUtility Unity Plugin,解决了以上的一些问题,为大家的开发提供了很好的便利。大家可以在Unity AssetStore中下载到,https://www.assetstore.unity3d.com/cn/#!/content/64219。 
本插件的联络邮箱为 [email protected],如果有问题可以通过这个邮箱反馈。 

我们会推出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, Actioncallback)
 
void ViveInput.AddPressDown(HandRole role, ControllerButton button, Actioncallback)
 
void ViveInput.AddPressUp(HandRole role, ControllerButton button, Actioncallback)
 
void ViveInput.AddClick(HandRole role, ControllerButton button, Actioncallback)
 
void ViveInput.RemovePress(HandRole role, ControllerButton button, Actioncallback)
 
void ViveInput.RemovePressDown(HandRole role, ControllerButton button, Actioncallback)
 
void ViveInput.RemovePressUp(HandRole role, ControllerButton button, Actioncallback)
 
void ViveInput.RemoveClick(HandRole role, ControllerButton button, Actioncallback)
 
        
添加和移除press、pressdown、pressup、click的监听事件 
void ViveInput.TriggerHapticPulse(HandRole role, ushort intensity = 500)
 
        
控制器上扳机的震动 


本帖最后由 Shengjie Zhang于 2016-9-1 11:00编辑

注:本文转载自blog.csdn.net的奥巴荣的文章"https://blog.csdn.net/obarong/article/details/52504764"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2491) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

101
推荐
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2025 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top