Hi, Im trying to make an HTC Vive app. I wanted to make a canvas - world space with 3d objects to be on top of everything. And so i followed this answer. https://answers.unity.com/answers/887498/view.html .. It works perfectly.
Then I made the canvas be a child of the camera so that the canvas moves as the camera moves. Then I adjusted the Position Z of the canvas so that it would be in front of the camera.
The problem I have is, I want to use the controller to raycast on the 3d object in the canvas. I already have the script for it to be detected. So the canvas is set to UI layer as instructed on the link above. For it to be raycasted, I have to pass the LayerMask as parameter to Raycast() function.
However, see the png file, I have to estimate the distance of the canvas for it to be hit. In the screenshot, the blue cube is the 3D object in the canvas. the violet line, is the laser pointer and it would only appear if there is a hit. In order for the violet laser to appear, I had to estimate where the blue cube is. If i directly point to the cube, raycast wont hit.
Sorry if my question is unclear. I am having a hard time finding the right terms to explain my problem. Thank you.