Search Unity

Google Cardboard select all objects ray collides with

Discussion in 'AR/VR (XR) Discussion' started by TestAccount3, Oct 16, 2017.

  1. TestAccount3

    TestAccount3

    Joined:
    Oct 9, 2017
    Posts:
    2
    Hello everyone,

    I'm using latest GoogleVR and unity 2017 and i'm trying to get all the objects that the reticle is pointing towards, but the raycast stops at the first item it collides with, so my question is how do i get the raycast to collide with a gameobject that is behind another one (or all the gameobjects ). Currently i just have a script that extends IPointerEnterHandler and have a OnPointerEnter event on the objects that i'm looking at and the raycast stops at the first gameobject.

    Thanks.
     
  2. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
  3. TestAccount3

    TestAccount3

    Joined:
    Oct 9, 2017
    Posts:
    2
    Hello and thank you for replying.

    Indeed i figured a solution would be for me to do a raycastall function and just get a list of objects, but i assumed googlevr would have this implemented already and maybe have all the objects in my PointerEventData at which point i would just call a getIntersects() or something like that in my OnPointerEnter(PointerEventData eventData) function and it would return all the game objects with colliders on them in it's path until the ray reaches max range. I'll try and see if there's anything i can do without casting another ray that would return all the gamebjects.

    Regards.