0

I want to get "Raycast Hit UI elements" in My Oculus Quest Project. So I used OVRRaycaster component of Oculus Intergration Asset. but I couldn't find any method about GetRaycastHitData.

/// <summary>
/// For the given ray, find graphics on this canvas which it intersects and are not blocked by other
/// world objects
/// </summary>
[NonSerialized]
private List<RaycastHit> m_RaycastResults = new List<RaycastHit>();

I found m_RaycastResults in OVRRaycaster.cs but i can't access. How can I get RaycastHit Objects or Current RaycastHit Object in Oculus Quest Project? Should I make new Ray Method Or Not?

  • Maybe this helps you? [Using Raycast instead of Gaze Pointer](https://stackoverflow.com/questions/56609334/using-raycast-instead-of-gaze-pointer) its from quite a while ago though ^^ Alternatively: For UI in general you rather want to use a [`GraphicRaycaster.Raycast`](https://docs.unity3d.com/2017.3/Documentation/ScriptReference/UI.GraphicRaycaster.Raycast.html) .. per default there is a `GraphicRaycaster` attached to every `Canvas` – derHugo May 31 '21 at 07:48

1 Answers1

1

My advise here is to avoid OVR components by just completely skipping the Oculus Integration Asset, and instead, basing your project on OpenXR API. The reasons are simple:

  • Oculus recently announced full OpenXR support on their devices while also rejectig self-developed API
  • there is gorgeous XR Interaction Toolkit developed by Unity, that is capable of what you want (raycasting against UI), and a lot more over it
Xander
  • 378
  • 1
  • 6