Search Unity

AR/VR mode switch

Discussion in 'AR/VR (XR) Discussion' started by stanislav_wong, Jul 7, 2019.

  1. stanislav_wong

    stanislav_wong

    Joined:
    May 8, 2019
    Posts:
    2
    Hi there. I know that here already exist thread with simmilar thema, but all threads are to old and doesen't help to me, thats why i've created new thread. So, what i actualy want to do is to switch camera mode from AR to VR by pressing a button, i've created AR app by using unity 2019.1.1f1 and Vuforia 8.3. Previously there was option to switch between AR and VR by using settings in vuforia ARCamera configuration (Set Eyewear Type to "Video See-Through) but unfortunality there is no more this option. I tried to set this setting manualy through C# script, but this functions is "depricated".
    Code (CSharp):
    1. public void changeMode2() {
    2.         if(currentType == EyewearType.None) {
    3.             DigitalEyewearARController.Instance.SetEyewearType(EyewearType.VideoSeeThrough);
    4.             currentType = EyewearType.VideoSeeThrough;
    5.         }else if(currentType == EyewearType.VideoSeeThrough) {
    6.             DigitalEyewearARController.Instance.SetEyewearType(EyewearType.None);
    7.             currentType = EyewearType.None;
    8.         }
    9.     }
    In unity it is possible to enable VR support and add some VR SDK like google cardboard, but it doesen't works to, for me there is only black screen, may be i have to special scene set up, i tried to google that, nothing found. For now i have next VR project settings settings
    upload_2019-7-7_16-0-7.png
    vr and ar settings was moved in unity to XR, thats why i use next code to switch mode
    Code (CSharp):
    1. public void changeMode() {
    2.      
    3.         if (XRSettings.enabled) {
    4.            XRSettings.enabled = false;
    5.         } else {
    6.             XRSettings.enabled = true;
    7.         }
    8.     }
    and there is result, camera is enabled, but it is to narrow
    upload_2019-7-7_16-4-8.png
    as you can see there is to big black frames. I don't understand why it's happens. Other options doesn't works for me, i tried to use Cardboard as VR SDK but i see only black screen.
    So does anyone knows how i can implement this in newest verions of unity and vuforia?
    I want to become result as in this video
    In video there is already set camera video mode "see through", actualy i have 2 problems first is how to switch camera mode from "seeThrough" (milti pass) to single pass, and then in vr mode if target was recongized set vr scene as in video

    P.S. Sorry for bad english.
     
    DhiaSendi and ton_fidalgo like this.