项目作者: cmbruns

项目描述 :
Valve的OpenVR虚拟现实SDK的Python绑定
高级语言: Python
项目地址: git://github.com/cmbruns/pyopenvr.git
创建时间: 2016-05-07T14:10:42Z
项目社区:https://github.com/cmbruns/pyopenvr

开源协议:BSD 3-Clause "New" or "Revised" License

下载


pyopenvr

Unofficial python bindings for Valve’s OpenVR virtual reality SDK, located at https://github.com/ValveSoftware/openvr

DEPRECATION NOTICE

Our upstream SDK OpenVR is no longer being updated. Everyone is switching to OpenXR instead. We are working on similar bindings for OpenXR at https://github.com/cmbruns/pyopenxr

Installation

Use

  1. import sys
  2. import time
  3. import openvr
  4. openvr.init(openvr.VRApplication_Scene)
  5. poses = [] # will be populated with proper type after first call
  6. for i in range(100):
  7. poses, _ = openvr.VRCompositor().waitGetPoses(poses, None)
  8. hmd_pose = poses[openvr.k_unTrackedDeviceIndex_Hmd]
  9. print(hmd_pose.mDeviceToAbsoluteTracking)
  10. sys.stdout.flush()
  11. time.sleep(0.2)
  12. openvr.shutdown()

For more advanced usage, consult the example at https://github.com/cmbruns/pyopenvr/blob/master/src/samples/glfw/hellovr_glfw.py, which is a complete faithful translation into python from the original C++ sample at https://github.com/ValveSoftware/openvr/tree/master/samples/hellovr_opengl