Search Unity

Problem with setting up GvrControllerPointer.

Discussion in 'Daydream' started by wojwen, Mar 10, 2017.

  1. wojwen

    wojwen

    Guest

    So I upgraded my project to the recent version of GoogleVR SDK and I'm trying to set up UI interaction. I added GvrControllerPointer and GvrEventSystem to my scene. When I test the scene the controller moves correctly, but the recticle is stuck in place and I get this warning every frame: "Using Raycaster (Raycaster: UnityEngine.UI.GraphicRaycaster, Object: ScreenCanvas). It is recommended to use GvrPointerPhysicsRaycaster or GvrPointerGrahpicRaycaster with GvrPointerInputModule".
    Do you know what am I donig wrong? Also I haven't upgraded Unity SDK for a while an I would be gratefull for any additional tip on UI interaction.
     
  2. dsternfeld

    dsternfeld

    Official Google Employee

    Joined:
    Jan 3, 2017
    Posts:
    72
    Hello!

    The latest version of the SDK requires that you use custom raycasters provided with the SDK instead of the default ones that come packaged with Unity. To use them, replace GraphicRaycaster with GvrPointerGraphicRaycaster and replace PhysicsRaycaster with GvrPointerPhysicsRaycaster.

    There are three main features that you get from using the custom raycasters that you don't get with the default ones:

    1. Support for two different Raycast Modes:
      Code (csharp):
      1. public enum RaycastMode {
      2.     /// Default method for casting ray.
      3.     /// Casts a ray from the camera through the target of the pointer.
      4.     /// This is ideal for reticles that are always rendered on top.
      5.     /// The object that is selected will always be the object that appears
      6.     /// underneath the reticle from the perspective of the camera.
      7.     /// This also prevents the reticle from appearing to "jump" when it starts/stops hitting an object.
      8.     ///
      9.     /// Note: This will prevent the user from pointing around an object to hit something that is out of sight.
      10.     /// This isn't a problem in a typical use case.
      11.     Camera,
      12.     /// Cast a ray directly from the pointer origin.
      13.     /// This is ideal for full-length laser pointers.
      14.     Direct
      15.   }
    2. The hit detection will respect the radius of the reticle. This only works for GvrPointerPhysicsRaycaster.
    3. Using a dummy camera on the pointer is not necessary when using the custom raycasters.
    Thanks,

    Dan
     
    Last edited: Mar 10, 2017
  3. wojwen

    wojwen

    Guest

    Thanks! Now when you explained this it seems pretty obvious :D
     
  4. wojwen

    wojwen

    Guest

    Maybe you can help me out with audio as well. No audio seems to be working after the upgrade and I have no idea why it doesn't work because I can't find anything in patch notes.