ViveSoftware / ViveInputUtility-Unity

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

Controllers don't show up on Oculus Quest when VIU_OCULUSVR_AVATARS is false #219

Open unoctium1 opened 3 years ago

unoctium1 commented 3 years ago

Tested on VIU 12.2 and both Unity 2019.4 and Unity 2021.1, and replicated with both standalone (via Oculus Link) and android.

It seems like the issue is with VIUOculusVRRenderModel.cs as the SetDeviceIndex method doesn't do anything due to the conditionals. I was able to fix this locally by just wrapping RenderModelCreator in OculusVRModule in an #if VIU_OCULUSVR_AVATAR block, so that it falls back to the default RenderModelCreator, but this probably isn't the most graceful solution

chengnay commented 3 years ago

@unoctium1 What is your testing environment setup? Which Oculus Integration version did you import/install? Or this is only install Oculus XR Plugin? And this solution is only for Oculus Quest? What about Quest 2? or other Oculus devices?

unoctium1 commented 3 years ago

@chengnay I've tested this both on Unity 2019.4 and Unity 2021.1, both using VIU 12.2. One of the projects I tested with (the 2021.1 one) was using XR management and the Oculus XR plugin and the other was using legacy XR. Both projects were using Oculus Integration, I'm not sure which version specifically but afterwards I was able to replicate the issue with the latest version (28.0.0).

The easiest way to replicate this is to open VIU in Unity 2019.4 and add the Oculus Integration, keep the build target on PC and add the Oculus SDK to the player settings, and then test on Quest 1 in Oculus link. The controllers did not show up in the sample scenes.

I only tested on Oculus Quest, as that's all I have available for testing Oculus devices. However, the solution is just falling back to the default render model creator which is already providing the correct controller models for any headset, so it should work across the board.

chengnay commented 3 years ago

@unoctium1 I tested your solution, and I found out that there is default render model(VIVE controller), but there is no input. Are you also getting the same result? Or from your side, you can have button inputs?

We will need some time to fix this issue for using latest Oculus Integration SDK. Sorry for the inconvenience.

unoctium1 commented 3 years ago

@chengnay No, I'm seeing Oculus Quest controllers and receiving button input. However, what you described (Vive controller & no button input) happens to me with or without my changes if the Oculus SDK is not being used and Unity falls back to OpenVR. Is that maybe happening on your end?

Edit: Just to be clear, without my changes and using the Oculus SDK, I just don't see controllers at all, but button input still works. My changes should just be adding back in the Quest controller models.

chengnay commented 3 years ago

@unoctium1 image

image

On my side, it reads as Oculus_Link_Quest_2 when I plug in Oculus Quest. Anyway, this issue will be fixed in next update (NOT v1.13.1). Thanks for using VIU. :)

chengnay commented 3 years ago

@unoctium1 I think I know the root cause to the VIU_OCULUSVR_AVATARS is not listed in the defined symbol field.

Please try this batch file to remove the asmdef files in VIU. VIU v1.12.2 accidentally uploaded the asmdef files that causes some of the symbols not loaded.

unoctium1 commented 3 years ago

@chengnay Ah sorry if I wasn't clear before, I'm specifically having this issue in projects not using Oculus Avatars, when VIU_OCULUSVR_AVATARS is undefined intentionally.

I do have this fixed locally on my end so no worries at all if it won't make it into VIU until after the next update!

chengnay commented 3 years ago

@unoctium1 By default, VIU_OCULUSVR_AVATARS should be added to defined symbol field. If it wasn’t added, then there must be something wrong with VIU.

If you try using the batch file, will VIU_OCULUSVR_AVATARS symbol be added now?

unoctium1 commented 3 years ago

After trying the batch file it seems that added in the symbol and then Quest control models from the Oculus Avatars folder showed up.

I do have some projects where the Oculus avatars folder is not imported into the project, but other parts of the Oculus Integration are in use. In these cases, wouldn't it make sense for VIU to fallback to using the VIU Oculus Quest controller models?

chengnay commented 3 years ago

@unoctium1 Those projects don’t have Oculus avatars folder imported is because you manually remove it? How can I make my project import Oculus Integration without Oculus avatars folder? Just uncheck the folder when I import the SDK? In those cases, what render model did you see in your scene? Probably VIU didn’t consider such cases, I will double check.

unoctium1 commented 3 years ago

@chengnay Yeah, you can either manually remove the folder or uncheck it when you import. In order to replicate you might also have to hit the 'repair define symbols' button in the preferences. In those cases, you don't see a render model at all. Button input does still work and VIU is correctly identifying the headset and controllers, it just isn't correctly assigning a model because SetDeviceIndex method does nothing due to the conditionals.

I realize this is a bit of a niche issue, so I appreciate how much time you've spent helping out with this!

unoctium1 commented 3 years ago

220 does fix this by wrapping the Oculus-specific override for the RenderModelCreator in an #if block so that it falls back to the default RenderModelCreator and uses the VIU Quest controllers. I think that should be fine since it seems like VIUOculusVRRenderModel only does Avatar-specific things