IVRSystem::GetControllerState
来源:互联网 发布:c语言冒泡排序比较方法 编辑:程序博客网 时间:2024/06/05 15:33
bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState )bool GetControllerStateWithPose( TrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, TrackedDevicePose_t *pTrackedDevicePose )
使用当前控制器的状态数据填充结构体:
1.vr::TrackedDeviceIndex_t unControllerDeviceIndex - 获取状态数据控制器的索引号
2.vr::VRControllerState_t *pControllerState - 存储控制器状态数据的结构体
3.TrackingUniverseOrigin eOrigin - 返回姿态数据所在的追踪设备空间的坐标系
4.TrackedDevicePose_t *pTrackedDevicePose - 当最后一个按键事件产生时,控制器的姿态数据会被存储到该结构体中。
使用当前的控制器状态数据填充这些结构体。如果因为某些原因导致控制器索引无效或状态数据不可取,则返回false。GetControllerStateWithPose会依据控制器最近更新的按钮状态,使用pose数据来填充pose的结构体。当用户按下或释放按钮时,如果需要一个精准的控制器pose作为输入到应用程序,则使用该格式。因为这个pose数据总是比当前的pose数据要旧,所以不应该使用它去做渲染。
控制器状态结构体:
/** Identifies what kind of axis is on the controller at index n. Read this type * with pVRSystem->Get( nControllerDeviceIndex, Prop_Axis0Type_Int32 + n );*/enum EVRControllerAxisType{k_eControllerAxis_None = 0,k_eControllerAxis_TrackPad = 1,k_eControllerAxis_Joystick = 2,k_eControllerAxis_Trigger = 3, // Analog trigger data is in the X axis};/** contains information about one axis on the controller */struct VRControllerAxis_t{float x; // Ranges from -1.0 to 1.0 for joysticks and track pads. Ranges from 0.0 to 1.0 for triggers were 0 is fully released.float y; // Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers.};/** the number of axes in the controller state */static const uint32_t k_unControllerStateAxisCount = 5;/** Holds all the state of a controller at one moment in time. */struct VRControllerState001_t{// If packet num matches that on your prior call, then the controller state hasn't been changed since // your last call and there is no need to process ituint32_t unPacketNum;// bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a maskuint64_t ulButtonPressed;uint64_t ulButtonTouched;// Axis data for the controller's analog inputsVRControllerAxis_t rAxis[ k_unControllerStateAxisCount ];};typedef VRControllerState001_t VRControllerState_t;
https://github.com/ValveSoftware/openvr/wiki/IVRSystem::GetControllerState
阅读全文
0 0
- IVRSystem::GetControllerState
- OpenVR之IVRSystem
- 欢迎使用CSDN-markdown编辑器
- 使用HttpClient实现文件的上传下载
- Java SpringMVC 支付宝-手机网站支付接口
- MongoDB
- 线程同步机制(互斥量,读写锁,自旋锁,条件变量,屏障)
- IVRSystem::GetControllerState
- SSM下的分页
- Android开发学习笔记:浅谈显示Intent和隐式Intent
- Scrum敏捷开发笔记
- WebStorm—scss转css配置
- [leetcode]94. Binary Tree Inorder Traversal@Java解题报告
- 算法竞赛入门经典训练指南 例题1-19 计算器谜题 Calculator Conundrum uva11549
- 卡顿优化
- springboot页面资源,静态资源读取