Friday, September 30, 2011

Exploring AR using Unity3D and Qualcomm AR SDK

This week, I spent a large amount of time wondering what I should do to spend my first week of holiday before throwing myself into the sea of assignments, which I will do on the 2nd and 3rd week of holiday later on. I decided to explore AR.

I've done AR before, using Flash and AS3:

Now I'm doing it again after 2 years, only this time I'm using the softwares which I'm most familiar with, Unity3D. As for the AR SDK, a lot of experts would suggest String (cuz it's more powerful, faster and stuff). But I'm more of a hobbyist developer and don't really plan on spending much money on developing commercial AR app/game just yet. Then I found Qualcomm, which is a royalty-free AR SDK for Android and iOS development.

The Qualcomm AR SDK download and getting started site gave an very good tutorial on how you could make your first AR app using Xcode or Unity. Soon after following the tutorial, I started building more stuff into the Unity scene and writing codes to test out the capabilities of the SDK. At the same time, I'm also thinking about the kind of app or game I wanna build using it, which makes me wanna know more and more about the SDK.

Here's some notes from those experiments I did in Unity (might be useful for certain beginners):
- when building a scene, it needs to have at least an ARCamera and an ImageTarget prefab.
- anything which is a child of the ImageTarget, will only show up/appear if the ImageTarget is tracked. Including those children which are moving around, as long as they are part of ImageTarget, they'll dis-/appear together with the ImageTarget.
- anything which is not a child of the ImageTarget, will appear static in front of the ARCamera in an AR scene. That said, anything that's outside of ImageTarget will always appear in the scene, and moving along with the camera as if the camera was its parent.
- For instance, if you're spawning some monsters into your AR scene, you're gonna want to make them a child of the ImageTarget; else if you just spawn them in the scene, they'll move as the camera move.
- you can call OnTrackableStateChanged (also listed in their getting started site) if you wanna detect whether or not the ImageTarget is tracked (appear in the scene when camera is facing the marker)
- if I'm not mistaken, you can only call OnTrackableStateChanged in an ImageTarget script (any script you dragged into ImageTarget)

I think that's about all the notes I have for now, if I have more I'll add them in here.

Anyway, I made an AR game using Unity3D and Qualcomm AR SDK, called YokaiShooter, where enemies called "Yokai" are gonna get spawn randomly into the scene and you're gonna have to shoot them down to prevent them from reaching the city.

Gameplay video:


Not coming to an AppStore near you :D

No comments: