- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
MiguelMiranda · May 02, 2019 at 01:28 PM ·
uivrraycasting
Graphic Raycaster Google VR
So I want to get a GraphicRaycaster result with Google VR, from where I am looking at. I followed this sample
GraphicRaycaster m_Raycaster;
PointerEventData m_PointerEventData;
EventSystem m_EventSystem;
m_PointerEventData = new PointerEventData(m_EventSystem);
m_PointerEventData.position = Input.mousePosition;
List<RaycastResult> results = new List<RaycastResult>();
m_Raycaster.Raycast(m_PointerEventData, results);
But I don't want the mouse input. Instead, I want it to be where I am looking at. I've tried to use
m_PointerEventData.position = new Vector3(Screen.width / 2, Screen.height / 2, Camera.main.nearClipPlane);
but since it is VR, the middle of the screen is nothing, since it is where the 2 images are divided. How can I get a simple Graphic Raycast to interact with the UI?
Thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612200559im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to get the intersection point between a UI WorldSpace with a Raycast from a Gazer ? 0 Answers
change value of child ui text element 2 Answers
How to send mouse events directly to the canvas in world pos 0 Answers
SteamVR Slider won't drag using VR Controller,SteamVR-controller can't drag Slider handle 0 Answers