Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Events on look (Cardboard SDK)

Discussion in 'AR/VR (XR) Discussion' started by Hashton, Nov 24, 2015.

  1. Hashton

    Hashton

    Joined:
    Nov 10, 2015
    Posts:
    25
    I want to have a go a creating some scripts that allow you to look at an object and when you do so it triggers another event to happen, such as you to teleport to a different place, or the object disappears to reveal something. By look at I mean when the target is over the object in Google cardboard SDK. Any scripts similar to this or that do this would be a brilliant way for me to begin to understand how this works. Thanks!
     
  2. guru20

    guru20

    Joined:
    Jul 30, 2013
    Posts:
    239
    I would consider raycasting. I used this approach, raycasting from the camera (in Oculus/Gear, though, haven't implemented in Cardboard... yet) and you can use this to get the raycast collision point.

    If you have an Oculus, you can try out my example "Rogue VR" work-in-progress demo at http://www.sanctuarymedia.com/RogueVR/roguevr-demos-downloads/

    It doesn't do much, but it does show how you can use a look-direction-defined interaction icon to play the game with no controller (which also makes it much more comfortable -- not dizzying/nausea-inducing)
     
  3. dolims

    dolims

    Joined:
    Sep 13, 2014
    Posts:
    61
    The demo scene in the Cardboard SDK uses gaze to cause things to happen: look at the cube and it changes color, click and it teleports. You can use that as an example.
     
  4. guru20

    guru20

    Joined:
    Jul 30, 2013
    Posts:
    239
    Yes... take a look at the methods in the GazeInputModule script for Cardboard... you'll see it does raycasting like I'd mentioned, and then triggers things to happen at the raycast collision point.

    What I'm looking to do next is change the default scripting so that I can use look-selection instead of trigger/button-select (ie. look at a target, show a countdown animation icon, and when time is up, trigger the event)... I did all this manually in Unity/Oculus VR already
     
    Hashton likes this.
  5. uzairamirs

    uzairamirs

    Joined:
    Jan 7, 2015
    Posts:
    8
    Hi Guru20,
    Did you find any solution? I am trying to teleport the cube in the demo scenes after 3-4 seconds delay but I am unable to do say.. Can't really understand the scripting... Could you or anyone else please help...

    Regards,
    Uzair Amir
     
  6. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    The following tutorials show how to implement gaze input with a timed delay. Pick one that suits your needs: