Search Unity

GVR Reticle (1.110.0)

Discussion in 'Daydream' started by dmennenoh, Nov 26, 2017.

  1. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    Using Google VR SDK 1.110.0 and Unity 2017.2.0f3
    I can't find any tutorial or doc on how I can use the reticle and raycasting to allow for gaze input. Everything I have found is for older versions of the SDK...

    Can anyone point me to something current? I just need to allow the users gaze to select between two buttons.

    Edit: I have GvrReticlePointer prefab as a child of the camera, and GvrPointerPhysicsRaycaster attached to the camera. Based of the GvrDemo scene... but whenever I play I get this error over and over: Using Raycaster (Raycaster: UnityEngine.UI.GraphicRaycaster, Object: Canvas). It is recommended to use GvrPointerPhysicsRaycaster or GvrPointerGrahpicRaycaster with GvrPointerInputModule.
     
    Last edited: Nov 26, 2017
  2. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    PhysicsRaycaster is used for objects with 3d colliders. GraphicRaycaster is used for any UI (Thing's that use a Unity canvas). Each canvas needs it's own GraphicRaycaster.

    In your scene hierarchy, search "t:GraphicRaycaster" and you will find all instances of GraphicRaycaster in your scene which you can then replace with GvrPointerGraphicRaycaster which works with GvrReticlePointer and GvrPointerInputModule.

    Thanks,

    Dan
     
  3. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    Sorry, but I don't entirely follow. On my Canvas I attached the GvrPointerGraphicRaycaster script. On my Camera I have GvrReticlePointer, and then I have GvrEditorEmulator, GvrEventSystem and GvrControllerMain in the scene. I am no longer getting any errors, so thank you. But is this correct? Is there a tutorial I can find on this?
     
  4. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    Update: So after some more reading, this is my current setup: I have a Unity Event System object, and have a Gvr Pointer Input Module attached to it, and placed above the Standalone Input Module. I I have a Canvas with several buttons in it - attached to the Canvas is Gvr Pointer Graphic Raycaster. Child of the Main Camera is Gvr Reticle Pointer and then lastly I have Gvr Editor Emulator and Gvr Controller Main prefabs just in the scene.

    It works, meaning I can see the reticle and look around, but I can't seem to get any events if I put the reticle over either button. Tried several things... have not been able to get it to work.

    Basically I just need to know when the reticle/gaze enters or leaves a button.

    Thanks
     
  5. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    In the scene GvrDemo, there is a canvas with buttons in it called "Floor Canvas" that you can look at to see how GvrPointerGraphicRaycaster is used. One common pitfall is that if you have nested Canvas's, you need a new GvrPointerGraphicRaycaster on each canvas.

    Also, I don't think this is related to your issue but you can use the prefab GvrEventSystem instead of modifying the default Unity Event System object yourself.

    GvrPointerPhysicsRaycaster and GvrPointerGraphicRaycaster are used almost exactly like Unity's PhysicsRaycaster and GraphicRaycaster, so I would recommend looking at Unity's event system documentation. Here is another tutorial specifically about building Daydream Apps. Some of it is a bit dated, but the section "Adding Interaction" may still help you understand how to use GvrPointerPhysicsRaycaster to interact with 3D objects.

    If this doesn't help, can you share some screen captures of your scene hierarchy and the inspectors for the canvases/buttons?

    Thanks,

    Dan
     
  6. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    There is some additional documentation here under the section "The Google VR Pointer System" section that may be helpful.

    Thanks,

    Dan
     
  7. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    Thanks much for that! I was I actually got it working - the issue was that Max Reticle Distance was too low on the GvrReticle component. Once I increased that everything is working. I was using GvrDemo for reference, and the hierarchy pretty much the same, which is why I was perplexed it wasn't working. Anyway, thanks a ton for the help.
     
    Michael_Truong and dsternfeld like this.
  8. Michael_Truong

    Michael_Truong

    Joined:
    Mar 18, 2015
    Posts:
    2
    Thank you so much for this. I had the exact same issue and increasing the GvrReticlePointer's Max Reticle Distance solved the issue.
     
  9. misterbung

    misterbung

    Joined:
    Nov 19, 2014
    Posts:
    2
    I'm having a similar problem, except I can't get the reticle to react when hovering over meshes.
    I have the Event system up, Event triggers running on the prefabs and the VR Pointer Physics Raycaster script on my main camera.

    Here's my project:
    https://i.imgur.com/MpaOhlY.png

    Here's the object I want interactable:
    https://i.imgur.com/pNgc24b.png

    ReticlePointer's Max is set to 100, so I've checked that.

    I really don't know where I'm going wrong and it's frustrating! Any help is appreciated.

    Do I still need to have a Canvas setup in the scene if I'm only interacting with objects and not GUI elements?