cmbruns / pyopenvr

Unofficial python bindings for Valve's OpenVR virtual reality SDK
BSD 3-Clause "New" or "Revised" License
255 stars 41 forks source link

Controller #49

Closed omt91 closed 5 years ago

omt91 commented 6 years ago

Hi there,

i use Python 3.5 64 bit on Windows and the pyopenvr works with the ViVe HMD perfect. Is it possible to get the raw postion data from both Controllers instead of the HMD?

Thanks! :)

matEhickey commented 6 years ago

Look at src/samples/track_hmd.py

# Create data structure to hold locations of tracked devices such as headsets, controllers, and lighthouses
poses_t = openvr.TrackedDevicePose_t * openvr.k_unMaxTrackedDeviceCount
poses = poses_t()

and

openvr.VRCompositor().waitGetPoses(poses, len(poses), None, 0)
hmd_pose = poses[openvr.k_unTrackedDeviceIndex_Hmd]

poses is an array that contains pose data of each tracked devices. Looking at mDeviceToAbsoluteTracking of a device get you the raw position of this device.