De-Panther / unity-webxr-export

Develop and export WebXR experiences using Unity WebGL
https://de-panther.github.io/unity-webxr-export/
Apache License 2.0
1.04k stars 110 forks source link

How to interact with UGUI with VRTK4 or Tilia UnityUI in 2021.3.17 #301

Closed luckyyjian closed 1 year ago

luckyyjian commented 1 year ago

I have been searching for how to interact with UGUI for weeks, but still couldn't find a way to solve this problem. I've tried using Indicators.ObjectPointers.Straight and VRTK4_UICanvas with tutorials, but the ray can't highlight the button yet(the ray only can detect collider on the Canvas). As you can see, i'm a newbie to WebXR, is there any way to use UGUI in WebXR?

De-Panther commented 1 year ago

Unity's canvas and event system require a camera for the rays. It doesn't have to be an active camera. So you can have a disabled camera attached to a gameObject (controller, view, whatever you like), and point it towards the canvas/button for it to activate. You do need to have an input module that would work with it. You can look for "gaze input module" to start with something and edit it however you like. There's an old sample I made 3 years ago https://github.com/De-Panther/WebXR-Unity-Samples

As it's out of the scope of this repo, I'm closing the issue. You can ask on the WebXR Discord for more help https://discord.gg/webxr