WebXR collision location on UI

Hello Guys,

I would like to create my VR laser beams with the right lenght.between the controller and the UI.

Is there a way for me to know exactly where my webxr laser beam will collide with the 3D UI? Where is the code for raycasting with UI happen (e3d UI use elements)?

Thanks!

Looking at the code, there’s no easy way to get the length of the ray to where it intersects the UI. I’m not even sure if it calculates it as it’s a line - quad intersection check.

The code is in element-input.js in the engine and there’s a function called : intersectLineQuad where it does the math for the ray check.

2 Likes

Thank you!