Log in or register to post comments

download object from server when tracker is found

March 1, 2011 - 6:11am #1

Hi.I am trying to do a application that will have a lot of objects.I don't want to put all the objects in the app since it will become very big.Can i download the files from a server when the tracker is found?

download object from server when tracker is found

November 3, 2012 - 9:15am #7

This depends on the type of object - is this a 3D object or other Unity asset, or is it a text file?

In Unity you can use AssetBundles for scene assets, and the WWW class for other file types - http://docs.unity3d.com/Documentation/ScriptReference/WWW.html

*AssetBundles are on available for Unity Pro.

To execute a download when detecting a specific target, extend the DefaultTrackableEventHandler..

    private void OnTrackingFound()
    {
        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();

        // Enable rendering:
        foreach (Renderer component in rendererComponents) {
            component.enabled = true;
        }

        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");

        switch( mTrackableBehaviour.TrackableName ){
           
        case "a" :
            // do something
            break;
        case "b" :
            // do something else
            break;
        default :
            // do nothing
            break;
        }

    }

download object from server when tracker is found

October 31, 2012 - 4:58pm #6

I apologize for my English, I write through a translator. Hello, could you describe clearly how to download object from server when tracker is found, using Unity3D. Preferably with a step by step description. A few days later I am suffering, does not work (. Thanks in advance!)

Re: download object from server when tracker is found

March 1, 2011 - 6:36am #5

I figured that using unity would be easier so i switched to that.Thanks for the help.

Re: download object from server when tracker is found

March 1, 2011 - 6:30am #4

Ah sorry, you were asking questions about the Eclipse project for the standard SDK before, I assumed you were still using that :)

This should be even easier in Unity. Look at the TrackableScript.cs file located in the Qualcomm Augmented Reality/Scripts folder. There is an OnTrackingFound method there that is called when a new trackable comes into view. You could trigger your download from that method.

- Kim

Re: download object from server when tracker is found

March 1, 2011 - 6:27am #3

Well i am trying to do this with unity . I found this thing that helps you do this: http://unity3d.com/support/resources/example-projects/assetbundles.html . I haven't investigated it yet but seems to be what i want.Hope it will work on android too.

Re: download object from server when tracker is found

March 1, 2011 - 6:22am #2

You can do this, but your users might not thank you for it :) Still, if you can figure out how to download the files from a server, it should be pretty easy to trigger this download when a particular target comes into view.

The trick will be to use the JNI (Java Native Interface) to call a Java method from native code, on the event of a new trackable being found. I suggest looking at the code in the following thread, it details how to display a message in Java with the name of the currently tracked target:

http://ar.qualcomm.at/node/2000032

Let me know if you have any questions!

- Kim

Log in or register to post comments