Log in or register to post comments

Cloud Test not Augmenting

May 18, 2014 - 2:19pm #1

Hi all,

I'm using this - https://developer.vuforia.com/forum/faq/unity-how-can-i-augment-my-image-target-model

Used this AssetBundlerAugmenter in my imagetargetchips....

everthin is working fine without error... fixed the script and the url is used from my server....

i can access my assetbundle from webpage and it downloads but when I  use it in the ImageTarget, No Augmentations are appearing on the marker...

i did use the iphone pipeline for the assetbundler..

any suggestion on what am i doing wrong pls?

Cloud Test not Augmenting

May 23, 2014 - 3:20pm #6

Excellent !!! It works like a charm now... so as in sample it works great... now i'll try building it to the CloudReco package sample...

Just to understand the structure... i upload the images in vuforia cloud and assign the url on the metadata... making sure the access key and server key is assigned from the cloud provided....then the image when tracked will trigger the url?

am i in the correct path pls? or do i have to do any other thing pls?

Cloud Test not Augmenting

May 23, 2014 - 12:17am #5

To attach an assetbundle to an image target, you'll seimply need to refer to the specific Image target and use some code like:

assetBundle.transform.parent = imageTarget.transform;

Practically you can implement it in your app code using various strategies, see for instance:'

https://developer.vuforia.com/forum/faq/unity-how-can-i-dynamically-attach-my-3d-model-image-target

https://developer.vuforia.com/forum/faq/unity-how-do-i-get-list-active-trackables

https://developer.vuforia.com/forum/faq/unity-how-can-i-augment-my-image-target-model

 

Cloud Test not Augmenting

May 22, 2014 - 6:14pm #4

ok i think the new downloaded asset bundle is not becoming a child of the image tracker which leads to this problem... i might be wrong but from what i've tested so far, it seems like it.... anyways, how do i make all augmented objects that are loaded from server to become the child of that particular image target as I have to call each image target from vuforia with a metadata telling it to download which assetbundle... any solution i could use to make sure all the future assetbundle will be a child to the image tracker pls?

Cloud Test not Augmenting

May 22, 2014 - 11:23am #3

ok i manage to fix this but now seems like the model is downloaded before tracking and it sits there even after the tracking is lost.... But as soon as it sees the tracker the model goes to the marker.... how do i fix this... the model is called from :-  www.idigisolutions.com/AR/pizza-iphone.unity3d

using System;
using UnityEngine;
using System.Collections;
	
public class AssetBundleAugmenter2 : MonoBehaviour, ITrackableEventHandler {
     
	public string BundleURL;
    public string AssetName;
    public int version;
     
    private GameObject mBundleInstance = null;
     
    private TrackableBehaviour mTrackableBehaviour;
     
    private bool mAttached = false;
     
    void Start() {  
        StartCoroutine(DownloadAndCache());
         
        mTrackableBehaviour = GetComponent<TrackableBehaviour>();
        if (mTrackableBehaviour) {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }
    }
 
    // Update is called once per frame
    IEnumerator DownloadAndCache (){
		// Wait for the Caching system to be ready
		while (!Caching.ready)
			yield return null;

		// Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
		using(WWW www = WWW.LoadFromCacheOrDownload (BundleURL, version)){
			yield return www;
			if (www.error != null)
				throw new Exception("WWW download had an error:" + www.error);
			AssetBundle bundle = www.assetBundle;
			if (AssetName == "")
				Instantiate(bundle.mainAsset);
			else
				Instantiate(bundle.Load(AssetName));
			
			 Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);
                Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);
         
                // Disable rendering:
                foreach (Renderer component in rendererComponents)
                {
                    component.enabled = false;
                }
         
                // Disable colliders:
                foreach (Collider component in colliderComponents)
                {
                    component.enabled = false;
                }
                	// Unload the AssetBundles compressed contents to conserve memory
                	bundle.Unload(false);
			} // memory is freed from the web stream (www.Dispose() gets called implicitly)
	}
			
     
public void OnTrackableStateChanged(
        TrackableBehaviour.Status previousStatus,
        TrackableBehaviour.Status newStatus) {
         
        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED ||
            newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) {
			

            if (!mAttached && mBundleInstance) {
                // if bundle has been loaded, let's attach it to this trackable
                mBundleInstance.transform.parent = this.transform;
                mBundleInstance.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
                mBundleInstance.transform.localPosition = new Vector3(0.0f, 0.15f, 0.0f);
                mBundleInstance.transform.gameObject.SetActive(true);
                 
                mAttached = true;
            }
        }
    }
	
}

 

Cloud Test not Augmenting

May 21, 2014 - 11:30pm #2

Hi, I can think of 2 or 3 things that could be wrong:

1.  the Asset Bundle has not been built with the correct Build target (e.g. it must be built with iOS build target if you want to use it in a iOS app, or Android built target if you want to use it in an Android app)

2.  the Asset Bundle has been produced with an old version of Unity (different from the one you are using to build your App that downloads the asset and uses it)

3. the AssetBundle 3D model is correct but it is out-of-scale (e.g. very small or very large scale), or it is not centered i.e. there is some local scale or local translation applied to the models that make them appear far from the target (so the model is there but you don't see it)

If you think point 1 and 2 are ok, than you could check point 3 by creating a new Asset Bundle which just consists of a simple Cube (place it at origin 0,0,0 and with a scale that makes sense) and try to import that.

 

Log in or register to post comments