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.
Google VR now uses a bunch of custom recasting and input scripts so might get tricky but you need to RaycastAll and out the result to an array of RaycastHits. Then you can loop through the hits to see what was hit:
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.