New To The Forum? Click Here To Read The How To Guide. -- Developers Click Here.

New Unity UI + OVR Look-Based Input HOWTO

124»

Comments

  • Thank you so much, I've been trying to implement this myself but found it kinda hard to do. Great work :)
  • Very nice :)
  • BudlogBudlog Posts: 3
    edited April 2016
    Hello and thanks for sharing,

    I have problem. Everithing works fine with WR enabled without oculus connected. But i cant click on buttons when oculus is connected. I thing there is issue with:

    lookPosition.x = Screen.width/2;
    lookPosition.y = Screen.height/2;

    I think the reason is in lookPosition is Vector2 with centre of Screen instead of some reference of camera direction centre. I have upgraded raycast im my project to camera instead of screen and it works perfectly. Is there any simple way to do something similar forlookPosition  ?
    I am using Unity 5.4.0b10

    Thank you for any advice.

  • sonnsoffsonnsoff Posts: 1
    As I am a noob, I have created a few UI buttons but each of them does not have an Event Camera field? How do I drag the 'Look Camera' into each of them as you describe in Step 5?

    "5. For every UI Canvas object you have in the scene, drag this "Look Camera" object into the "Event Camera" field."

    Thanks for the help guys and sorry to be the noob asking nooby questions! :-)
  • ccsccs Posts: 219
    Hiro Protagonist
    Only the Canvas component has an Event Camera field, and you don't actually have to set it anymore as it defaults to the Main Camera which is a unified, both-eye VR camera nowadays. A while back the Oculus integration was 2 separate cameras for each eye, and in that case it helped to have a "center" eye fake camera so the cursor/look point would be dead center.
  • ccsccs Posts: 219
    Hiro Protagonist
    I just updated to 5.4 beta and I see this is no longer working. I'll try to figure out what is broken.
  • ccsccs Posts: 219
    Hiro Protagonist
    edited May 2016
    I can no longer edit original post, but here is an update that works with 5.4beta (version 16 as of this post).

    https://www.dropbox.com/s/q8zcylzs1ggt24n/LookInputSampleV6.zip?dl=0
    1. Completely removed OVR utils and OVR integration. Switched to native VR including adding OpenVR as supported platform
    2. Changes from using Screen.width and Screen.height to using UnityEngine.VR.VRSettings.eyeTextureWidth and eyeTextureHeight to get center point accurately. 
    For those that don't want to re-download, here is the quick fix in LookInputModule.cs that fixes the raycast point:

    @Budlog take note! :smile: 

            lookPosition.x = UnityEngine.VR.VRSettings.eyeTextureWidth/2;
            lookPosition.y = UnityEngine.VR.VRSettings.eyeTextureHeight/2;
            //lookPosition.x = Screen.width/2;
            //lookPosition.y = Screen.height/2;

    ccs

  • MeioJoMeioJo Posts: 167
    Very Helpful :smiley: 
  • MeioJoMeioJo Posts: 167
    edited May 2016
    Yesterday I tried out this demo scene and it worked... I then started to incorporate this info into my own scene but I can not get the look at cursor to operate when I push a button on controller...

    Pulled my hair out for a while then went back to the demo script and now there is no button press detection in that now either.

    I checked Oculus Home and all is well so I can't figure out what is going on?
  • MeioJoMeioJo Posts: 167
    Okay it fixed itself somehow.. :cold_sweat: 
  • AJCMPCAJCMPC Posts: 7
    NerveGear
    I've just implemented the shift native camera instead of OVRCamera and to eyeTextureWidth and eyeTextureHeight, which fixed the trigger offset issues I was having with this module. Now, the implementation works great in the Editor and on Rift. If anyone is having trouble with it still, note that like mouse UI interaction, lots of problems can arise from forgetting to use the IgnoreRaycast script everywhere's it's needed, especially in multi-layer UIs.

    All seemed well, but I just tested it in GearVR and got no trigger activity. Specifically, I've implemented triggers for OnPointerEnter and OnPointerExit. Neither are firing. Anyone have any thoughts as to why they would work in Rift but not GearVR?
  • Sidian07Sidian07 Posts: 1
    NerveGear
    Hi hey, I just tried it out, thx for the tutorial and all, but when copying the script l get this error at the end of the code:

    I'm a complete newbie in this whole scripting world, so of course l don't dare to touch the code by myself. I'm using Unity 5.2

    Thanks
  • imperativityimperativity Posts: 1,456 Oculus Staff
    Hi,

    Welcome to the Oculus Forums.

    Please update to the latest version of Unity if you are able to. Most every error or bug is resolved by upgrading to the latest release.

    You can consult the official Oculus compatibility chart below to ensure all your plugins are compatible as well:

    https://developer3.oculus.com/documentation/game-engines/latest/concepts/unity-sdk-version-compatibility/


  • vrdavebvrdaveb Posts: 1,557 Oculus Staff
    Looks like an HTML copy + paste error. Can you replace "&gt;" with ">" and "&lt;" with "<"?
  • SkorchoSkorcho Posts: 2
    NerveGear
    Hi there,
    Thanks for the effort, finding this really useful for a design project I'm working on.

    One stumbling block, I'm trying to move the camera position at runtime, think FPS controller, while using the tool, and am having problems with the pointer loosing track of this change, and eventually disappearing, any easy solution you can think of?

    Sergio 
  • krisventurekrisventure Posts: 53
    Brain Burst
    @ccs
    But it currently doesn't take care of deselecting UI button after it's highlighted. Using your 2016 updated version. Buttons stay highlighted until I click elsewhere. In Unity editor VR supported, Unity 5.4.3f1, OVR version 1.0.1. It also doesn't scroll down. Same things work well with Standalone input module but that I can't use to track look directions. Yours would be perfect but there are these bugs in my case.
124»
Sign In or Register to comment.