Topic locked

Upgrading to QCAR Unity 1.0

April 26, 2011 - 5:24pm #1

Here is a guide for updating your existing Beta 2 Unity Extension projects to 1.0. Please note that most of the QCAR-provided scripts have changed, in terms of both class names and functionality. We suggest starting by studying the new samples and reading through the updated documentation (http://ar.qualcomm.com). Then follow these steps to upgrade your project. Please let us know if you run into any problems! Upgrading 1) Make sure you have a backup of your project. 2) Copy any QCAR scripts that you have edited (e.g. TrackableScript.cs) to a safe place. Make note of your changes. 3) Delete the entire Editor/QCAR/Scripts folder and the entire Qualcomm Augmented Reality folder. 4) Save your project and close Unity. 5) Reopen Unity and your project. 6) Import the QCAR-1.0.0.unitypackage, accepting all changes. 7) Resolve any script errors at this point. Note that most of the QCAR class names have changed (e.g. TrackerScript is now TrackerBehaviour). You can grab a new InitializationErrorHandler for the ARCamera from the sample projects (Scripts folder). Also IImageTargetEventHandler has been replaced with IVirtualButtonEventHandler. 8) Drag the Qualcomm Augmented Reality/Scripts/CameraDeviceBehaviour script onto the ARCamera in your scene (this script is now part of the ARCamera prefab). 9) Now to handle your existing trackables. The simplest way to ensure success is to drag out a new trackable prefab for each trackable in your scene, select the appropriate target/marker, and match its transform to your existing trackable. Then you can drag all the children of your existing trackable onto this new trackable. Be sure to copy over any scripts attached to the old trackable, and then remove the old trackable from the scene. 10) Add an implementation of the ITrackableEventHandler interface to each of your trackables. You can grab the default implementation from any of the sample projects (Scripts/TrackableEventHandler.cs) as a good starting point. This script is the new source for OnTrackingFound/OnTrackingLost callbacks. 11) Double check your config.xml file to make sure nothing was lost (e.g. frame markers, virtual buttons). If your project uses MultiImageTargets please note that these have been renamed to MultiTargets. You can edit the config.xml by hand or redownload your tracking files from the Target Management System (My Trackables). 12) Work any of the script changes you noted in step 2 into the new QCAR scripts. In general, try to keep your application-specific code separate from the QCAR code as much as possible; this will make future upgrades easier. Hopefully the new event interfaces will help with this. Notes Note that the default mesh for trackables has changed. It is now a 1x1 procedurally generated mesh, instead of a 10x10 Unity plane primitive. This can cause two possible issues: 1) If your scripts depend on a plane that is 10x10 units, your localPosition calculations may be off by a factor of 10. One simple fix is to add an empty game object with a scale of 0.1, 0.1, 0.1 between the trackable object and your child objects. 2) There is no longer a collider attached to the trackable prefabs. You can add your own collider via the Component > Physics menu. Troubleshooting If the screen is black (no camera image) you most likely need to add the CameraDeviceBehaviour script to your existing ARCamera object.

Topic locked