Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
EndritP's avatar
EndritP
Honored Guest
7 years ago

Creating a hand UI menu to occlude the OVR Avatar controllers

Not sure if this will be helpful to anyone, but I wanted to share the workaround I did to stop the OVRAvatar hands showing through any UI hand menu. I basically wanted to have a togglable UI hand menu as a child of the LeftHandAnchor.
At first I tried to apply a custom shader to the UI components, to try and get them to render over everything - https://answers.unity.com/questions/878667/world-space-canvas-on-top-of-everything.html
This didn't work for whatever reason, and neither did messing around with the sorting Layers.

To fix this I basically went into the following shaders:
OVRAvatar_PC_SingleComponent
AvatarSurfaceShaderPBS
and this script:
OvrAvatarSkinnedMeshRenderPBSV2Component

in the first 2 shaders I changed the RenderQueue to geometry.
In the script I removed this line of code:
mesh.sharedMaterial.renderQueue = OvrAvatarMaterialManager.RENDER_QUEUE;

That bit of code seems to override the renderqueue set by the shader, by setting it to 3640 which I didn't want. 

With these changes I could make UI elements appear over the oculus hands + controllers without the hands showing through.

I'd be interested to hear how anyone else solved this problem or if it came up for them.

-E
Replies have been turned off for this discussion