ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
352 stars 82 forks source link

Vive controller on Index headset returns by device ID that it is an Index controller #200

Open wirelessdreamer opened 3 years ago

wirelessdreamer commented 3 years ago

// The controller we want to look up the type on uint deviceIndex = GetComponentInParent().viveRole.GetDeviceIndex();

Debug.Log("Check controller type: " + VRModule.GetDeviceState(deviceIndex).deviceModel + " ID: " + deviceIndex);

Output: Check controller type: IndexControllerRight ID: 1

image

chengnay commented 3 years ago

@wirelessdreamer Currently, I do not have Index device to debug. Could you help to print out the log in this script (Assets\HTC.UnityPlugin\VRModule\Modules\SteamVRv2Module.cs)? Line 559, Help to print out deviceClass, serialNumber, modelNumber and renderModelName, thanks!

wirelessdreamer commented 3 years ago

That Ifdef isn't active, so I'd never hit the related section of code image

chengnay commented 3 years ago

Which SDK did you import for your project? Please list the versions of your Unity Editor, SDKs... etc Thanks!

wirelessdreamer commented 3 years ago

Unity 2019.4.8.f1 VIU 1.12 Oculus Integration 20.1

chengnay commented 3 years ago

@wirelessdreamer I found the root cause is that XRDevice.model will return "Index". With combination of Index HMD + VIVE controller, XRDevice.model will not return "VIVE" for controller. We are still working on how to resolve this issue.

chengnay commented 3 years ago

@wirelessdreamer Here is the solution, In Assets\HTC.UnityPlugin\VRModule\Modules\UnityEngineVRModule_2017_1.cs, Line 252, if (!XRDevice.model.Equals("None")) { currState.serialNumber = XRDevice.model + " " + m_nodeStateList[i].uniqueID.ToString("X8"); var model = Input.GetJoystickNames()[0]; if (string.IsNullOrEmpty(model)) { currState.modelNumber = XRDevice.model + " " + m_nodeStateList[i].nodeType; currState.renderModelName = XRDevice.model + " " + m_nodeStateList[i].nodeType; } else { currState.modelNumber = model; currState.renderModelName = model; } }