How to detect device degrees of freedom on the Unity Wave SDK?

SOLVED
Highlighted
mmarcati
Contributor

How to detect device degrees of freedom on the Unity Wave SDK?

Hello everyone,

I'm developing a game in Unity that's supposed to be both 6-dof and 3-dof compatible, and should detect the degrees of freedom of the device automatically. I can't find on the Unity Wave SDK any way to detect that. Anyone has any ideas?

 

Thank you!

Marcelo


@JustinVive @Tony PH Lin

Vive Staff

Re: How to detect device degrees of freedom on the Unity Wave SDK?

You can refer below link for detail description for 3Dof (rotation only) and 6Dof (rotation + position).

https://hub.vive.com/storage/app/doc/en-us/WaveVR_ControllerLoader.html

Thanks.

mmarcati
Contributor

Re: How to detect device degrees of freedom on the Unity Wave SDK?

Thank you for the reply, @Tony PH Lin, but I think you may have misunterstood the question.

I need to automatically detect in runtime wether the HMD (not the controller) is 3DoF or 6DoF.

I'm developing a game that I will publish on the Vive Wave platform. When the user runs the game, it should detect wether it's running on a 3DoF or a 6DoF HMD so it can activate the correct functionalities.

I only found this:

https://hub.vive.com/storage/app/doc/en-us/WVR_GetDegreeOfFreedom.html

But I'm not sure it it's what I'm looking for since it's a function for the native Wave SDK and not the Unity Wave SDK.

Vive Staff
Solution

Re: How to detect device degrees of freedom on the Unity Wave SDK?

Yes, you're right.

The function is WVR_GetDegreeOfFreedom and it's exported in wvr.cs.

You can receive return value along with different DeviceType.

 

        [DllImportAttribute("wvr_api", EntryPoint = "WVR_GetDegreeOfFreedom", CallingConvention = CallingConvention.Cdecl)]
        public static extern WVR_NumDoF WVR_GetDegreeOfFreedom(WVR_DeviceType type); 
mmarcati
Contributor

Re: How to detect device degrees of freedom on the Unity Wave SDK?

Thank you, @Tony PH Lin!

That's indeed what we were looking for. We actually had found a similar solution just before I saw your post, but we're using the WaveVR.Instance.is6DoFTracking function, which, if I understand correctly, calls the solution you provided.

Here's what our solution looks like:

 

        int x = WaveVR.Instance.is6DoFTracking();
        if (x == 3)
        {
            control_3dof = true;
        }
        else if (x == 6)
        {
            control_3dof = false;
        }

        else
        {
            control_3dof = false;
        }