Search Unity

unity 4.5 Oculus Rift Scripting Reference

Discussion in 'AR/VR (XR) Discussion' started by Ridgerunner, Mar 20, 2015.

  1. Ridgerunner

    Ridgerunner

    Joined:
    May 31, 2014
    Posts:
    34
    Is there any one that know about how to use the Oculus with the new UI in Unity 3d 4.6 / 5 I'm trying to make a simple button in the UI be able to work but have not had any luck do so,
    I guess when it come to Oculus you need all the luck you can LOL!
    I have not found any Scripting Reference or how to use the Oculus with the new UI....
    Can some one Please give me a hand???
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    You should almost definitely use World Space Canvases. Regarding the scripting reference: I'd say you simply use the normal scripting reference because from the API perspective, I don't think there's much difference. One thing, though, might be that you might not really want to use the mouse / mouse cursor in VR ... or you might have to implement your own 3d-space cursor to make things work properly. But as far as I know, there's no API available for that - that's something you'll have to code on your own.
     
  3. Ridgerunner

    Ridgerunner

    Joined:
    May 31, 2014
    Posts:
    34
    Okay thank you
     
  4. Ridgerunner

    Ridgerunner

    Joined:
    May 31, 2014
    Posts:
    34
    So can some one Help me I'm trying now to get a gameobjet/collider to trigger a UI button just like if it was a mouse ccursor can some give m a hand with this idea???
     
  5. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    This is how I'm doing it, a mouse driven system. This is Rift DK2 with Unity's 4.6 UI. Runs great, I can use the same GUI for standard monitors as used in the Rift. Just have to position and control things a bit differently.



    I used this as a starting point.
    http://ralphbarbagallo.com/2014/08/...ursors-for-world-space-canvases-in-unity-4-6/

    His code is linked to here: https://gist.github.com/flarb/052467190b84657f10d2

    I remember getting some error or warning with it on Unity 5, don't know what. I just removed the code that wasn't working and went from there. Anyway, that should hopefully get you moving in the direction of making a button that's clickable with a 3D mouse cursor. I just made a little sphere with a collider on it and put a collider around each button.

    On Rift UI design in general: I had tried a pure "look at" type of system too:



    I found that a bit more hassle to work with as a user than it was worth, especially with my particular GUI needs. It was neat to see and play with, but I liked the mouse driven system more. Plus you can use the same GUI and not have to do everything twice.