Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Ybalrid's avatar
Ybalrid
Expert Protege
10 years ago

PC Developer guide and Touch and other oddities on the SDK

Hi there, you know me, I'm that boring person that will point out that the content of the guide doesn't correspond to the current version of LibOVR ^^"

Obviously when I got my touch controller, the first thing I did after setting it up and redeeming and downloading all the games I could for it was to fire-up visual studio and opening the documentation (while waiting for stuff to download :tongue:)

So, the content of the ovrInputState on this page of the guide is wrong https://developer3.oculus.com/documentation/pcsdk/latest/concepts/dg-input-touch-buttons/, at least the ConnectionState member doesn't exist, it probably should be renamed "ControllerType", that's what is in the actual code, so if somebody at oculus could fix that ^^"

And if would be nice to put a spinet of code at the start of the section about touch input that will detect if there's actually Touch Controller active right now.

Something of this style would do :

    //Get the controller state
    if (OVR_FAILURE(ovr_GetInputState(session, ovrControllerType_Active, &inputState))) {/*cant get inputstate for some reason*/}
    //Check if there's Oculus Touch Data iside this thing
    if (!(inputState.ControllerType & ovrControllerType_Touch)) {/*There's no Touch Controller here*/}

Also, I experimented a bit, and I think the SDK doesn't handle properly the case where there's only one Touch Controller actually connected, it report data for both of them.

There's 3 values of ovrControllerType that are associated with touch, intended to be used as bit flags. left touch is 1, right touch is 2. The "ovrControllerType_Touch", as expressed in the code is 3, so it check for both bits.

If there's only, let's say the left controller present, testing
inputState.ControllerType & ovrControllerType_Touch 

Should be false, but it is true, because both the LTouch and RTouch bits will be set. And the corresponding pose in the tracking state seems to hold like the "last known position" of the missing controller.

(Thinking about it, it depends on what the ovrControllerType_Touch flag means: if it's "there's some touch present here", maybe another value should be used for that instead of testing the presence of both controllers...)

The only one kind of game that, as far as I know, uses only one Touch would be that rockband VR (that I'm strangely hyped for), where the controller is used to track  the guitar, so the use case exist. But there's no way to know by code that one of the controllers is off.


Theses oddities aside, Touch is super easy to integrate, as always. kudos for the PC SDK team ;)



No RepliesBe the first to reply