ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.07k stars 1.28k forks source link

How to get TrackedDevicePose_t when IsDashboardVisible() returns true? #997

Open Hoodad opened 5 years ago

Hoodad commented 5 years ago

With an overlay app that runs in the background like helloworldoverlay. And you need to know if the TrackedDevicePose_t.bPoseIsValid is valid for the HMD how do you do?

According to https://steamcommunity.com/app/358720/discussions/0/530649887208913423/ the correct way to poll if HMD is being tracked is to use GetControllerStateWithPose. However as soon as OpenVR.Overlay.IsDashboardVisible() returns true GetControllerStateWithPose returns false all the time.

Roughly what I want to achieve is to know if a device is being tracked or not regardless if the dashboard is being shown or not.

// Init
OpenVR.Init(ref result, EVRApplicationType.VRApplication_Overlay);

// Update loop
var result = OpenVR.System.GetControllerStateWithPose(trackingSpace, deviceIndex, ref controllersState, sizeControllerState, ref trackedPose)
if(result)
{
    Debug.Log(trackedPose.bPoseIsValid ? 1 : 0);
}

A possible solution would be to add a method similar to IsDashboardVisible() for the HMD i.e. OpenVR.Overlay.IsHmdBeingTracked()

Any help is greatly appreciated!

Hoodad commented 5 years ago

The issue #628 is describing the same problem. When the dashboard is visible you loose the ability to read certain values.