cancel
Showing results for 
Search instead for 
Did you mean: 

How to use graphics raycaster with physics raycaster?

Weitin
Protege
I'd like to be able to interact with UI elements and 3D objects together in the same scene. I have the OVRRaycaster on my canvas, and OVRPhysicsRaycaster on the OVRCameraRig. Both work correctly by themselves, but the Physics Raycaster will still hit an object even if there is a canvas in front of it.  
I've played around with the blocking objects, blocking masks, and other settings. I've tried EventSystem.current.IsPointerOverGameObject() but it didn't seem to do anything. And I've tried to tweak the OVRPhysicsRaycaster script to no avail.
From what I've read, the Physics Raycaster doesn't detect any graphic elements, so potentially Graphic Raycasts should be done first, and if nothing is hit, then call Physics Raycaster? Does the Oculus SDK have a solution for this or am I better off writing my own system?
2 REPLIES 2

Weitin
Protege
I solved it, OVRPhysicsRaycaster sort order is set to 20 by default, I set it to 0...

rathna11
Honored Guest
Can you please help me by telling me what did you write in the script that is attached to 3d object. Because I have OVR physics raycaster on OVRcamerarig & OVRraycaster on canvas I'm able to interact with canvas but not 3D object. Im using Input.GetMouseButtonDown(0)  on 3D object. Can you please help me with this