Final - Magic Window and XR

Hey, finally the last class comes. As promised, I made a weather assistant that lives in my door, reminding me if I should bring umbrella out with me. Check my last post here to see more details about the proposal.

So here's what I did!

1 Setting up AR environment

I didn't expect the setup would take such a long time. The struggling point here was that the ARKit I used for Unity 2020 didn't show up a satisfying image tracking result. I did see the cube coming up when the camera detected the tracked image, yet it couldn't move as the device changed its position and angle, which was super frustrating. After watching tons of tutorials and changing the setup without any progress, I decided to switch back to the Vuforia Engine that I used last year.

The Vuforia Engine somehow couldn't compile in my Unity 2020 version. I tried multiple combinations to find out a working environment for both software. Finally I figured that Unity 2019.3.1.8f was a perfect match for Vuforia 8.5.9 (has to be the exact version!).

2 Scene Design

I downloaded a cute character -- a dragon -- as my weather assistant. As planned, the dragon would bring an umbrella with me as the weather goes bad. So I imported the umbrella as well.

As for the targeted image, I took a picture of my front door and set it as the image target so that it could trigger the gameobjects as it was shown in the camera.

3 Fetching Weather

It was new to me in terms of how to get webAPI in Unity environment. Thanks to Rui's detailed tutorial, this step became so much easier than I thought. I use getRequest to fetch weather info for a certain city. To see if I need umbrella in a certain type of weather, I made a judgement once fetching the weather code. If the umbrella was needed in weather like snow, rain, drizzle etc, the umbrella would show up in the scene.

I also add a small function which you can tap to switch cities to get to know the weathers all over the world.

Code segments of switching cities | See the weathers for 9 cities above

Weather API I used: https://openweathermap.org/current