Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Using GPS and Camera in WP8

Discussion in 'Windows' started by nekk1, Oct 13, 2013.

  1. nekk1

    nekk1

    Joined:
    Nov 27, 2012
    Posts:
    14
    Hello guys.

    I'm building an application which includes GPS navigation and Camera for Augmented Reality purposes.
    Is this achievable in the current version of Unity? Do I have to stick all the elements in one page, and show/hide them when needed?

    So far I figured that you can't switch to another XAML pages without having bad experience i.e crashing the app.

    Thanks, Nenad.
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,772
    GPS and Webcam support has been added to 4.3 version (currently beta).
    When working with XAML you have to disable Unity input so that Unity does not respond to events passed to XAML controls.
     
  3. nekk1

    nekk1

    Joined:
    Nov 27, 2012
    Posts:
    14
    Thanks for the response Aurimas.

    I managed to disable the Unity interaction, however, I can't hide the DrawingSurfaceBackgroundGrid. It always draws in the background.
    I tried with collapsing it, then setting Unity resolution to 0x0, and painting it black afterwards, but none of that worked.

    Any tips on how to hide it completely?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,745
    Did you try painting black border with black background on top of it (in XAML)?
     
  5. nekk1

    nekk1

    Joined:
    Nov 27, 2012
    Posts:
    14
    Sorry for responding this late, but this is what I'm trying.

    Code (csharp):
    1.  
    2.         Brush _backgroundDrawBrush;
    3.         Brush _opacityBrush;
    4.         private void SetVisible(bool visible)
    5.         {
    6.             if (!visible)
    7.             {
    8.                 UnityApp.Obscure();
    9.                 _backgroundDrawBrush = DrawingSurfaceBackground.Background;
    10.                 _opacityBrush = DrawingSurfaceBackground.OpacityMask;
    11.                 DrawingSurfaceBackground.Background = new SolidColorBrush(Colors.Black);
    12.                 DrawingSurfaceBackground.OpacityMask = new SolidColorBrush(Colors.Black);
    13.                 DrawingSurfaceBackground.Visibility = System.Windows.Visibility.Collapsed;
    14.                 DrawingSurfaceBackground.Opacity = 0;
    15.             }
    16.             else
    17.             {
    18.                 UnityApp.UnObscure();
    19.                 DrawingSurfaceBackground.Background = _backgroundDrawBrush;
    20.                 DrawingSurfaceBackground.OpacityMask = _opacityBrush;
    21.                 DrawingSurfaceBackground.Visibility = System.Windows.Visibility.Visible;
    22.                 DrawingSurfaceBackground.Opacity = 100;
    23.             }
    24.             DrawingSurfaceBackground.UpdateLayout();
    25.         }
    I was hoping that at least I'll get a result by including this many properties, but nothing is changing unfortunately.
    How should I approach hiding the Unity screen?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,745
    UnityApp.Obscure doesn't hide unity screen. It's an event handler for when you get a phone call/something else pops up on your screen (that is not controlled by your application). It tells unity to mute the sounds and send pause events to the scripts. It also stops rendering, but it won't make the frame black.

    My suggestion was this, though:

    Code (csharp):
    1.  
    2.     <DrawingSurfaceBackgroundGrid x:Name="DrawingSurfaceBackground" Loaded="DrawingSurfaceBackground_Loaded">
    3.         <Border Name="HideUnityBorder" Background="Black" Visibility="Collapsed"/>
    4.     </DrawingSurfaceBackgroundGrid>
    5.  
    And just make that border visible/collapsed.