ValveSoftware / openvr

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

Is there a way to ensure that a background application receives input first? #1062

Open MiWiesing opened 5 years ago

MiWiesing commented 5 years ago

I'm looking for a way that a allows me to log the time when a button on the controller was pressed with a high precision (e.g. frame rate independent). In order to do so, I wrote an app that runs in the background of Unreal and save a timestamp whenever a button was pressed. Most of the time my app receives the input earlier than UE4 does. However, sometimes its actually later than UE4. I guess that there is some kind of conflict when both apps want to process the input almost simultaneously. Is there a way to give my background app a higher priority to ensure that its receiving the input as fast as possible and before UE4 does? Maybe something like a windows keyboard hook, but for the controller input events?

BOLL7708 commented 5 years ago

I'm going slightly off topic here, but are you using the new input system in the background application or are you running an older version of SteamVR and listening to the events? I'm mostly asking as I'm about to restart implementing the new input in my own background application soon.

MiWiesing commented 5 years ago

I'm using the new input system. However, my background app is quite simplistic and mostly hacked together by looking into your OpenVRInputTest repo and this one https://github.com/username223/SteamIVRInput-Cpp-Example This is just for some simple latency tests of the Vive controller that I would like to include into a research project (I'm a PhD student in neuroscience).

BOLL7708 commented 5 years ago

The fact you could use my non-functional project as reference is awesome, is your own application C# or C++?

I'm still struggling getting this to work, you motivated me to revisit it but still no state changes getting through even if I generated the bindings through the interface, which as impossible before 🤔 Feels like I must be missing something essential, will scour the internet for working examples later, if any have come into existence since last time.

Sorry for derailing the discussion, just, saw a glimmer of hope here 😅

MiWiesing commented 5 years ago

Nice to hear that I could motivate you to revisit your project. My project is in C++. I looked again through you code, but couldn't find any obvious difference in your implementation compared to mine and I could not figure out why you are not receiving the action state changes (which I assume is the problem you are struggling with). My guess is, that it's maybe something c# specific?!

Btw no problem with derailing the discussion! :)