Log in or register to post comments

Upgrade to v2.6.7 unity

August 19, 2013 - 12:03pm #1

HI,

I just upgrade to the new version v2.6.7, I have three imageTargets and Now the ARcamera shows all my imageTargets in the screen when I run it, I just what to show one ImageTarget at a time on my android device:

 

Please see attached image:-=

 

Best Regards

Daniel

AttachmentSize
Image icon image.jpg316.51 KB

Upgrade to v2.6.7 unity

August 19, 2013 - 1:11pm #5

HI David,

Yes all my augmentations are rendered on my cpu and my android phone:-( I only use One ImageTarget and my AR camera is set to 1 simulations imageTargets

you can see my (I call it FKTrackable) if  you can see if there something wrong with the Eventhandler. The code is almost  the same on all my three EventHandlers ;.)

Thanks again

Next I try the ImageTarget sample method;:)

 

Best

Daniel

 

/*==============================================================================
            Copyright (c) 2010-2013 QUALCOMM Austria Research Center GmbH.
            All Rights Reserved.
            Qualcomm Confidential and Proprietary
==============================================================================*/

using UnityEngine;

/// <summary>
/// A custom handler that implements the ITrackableEventHandler interface.
/// </summary>
public class FKTrackable : MonoBehaviour,
                                            ITrackableEventHandler
{
    #region PRIVATE_MEMBER_VARIABLES
 
    private TrackableBehaviour mTrackableBehaviour;
    
    #endregion // PRIVATE_MEMBER_VARIABLES

    public AudioSource sfx_ovenover;
    
    

    #region UNTIY_MONOBEHAVIOUR_METHODS
    
    void Start()
    {
        mTrackableBehaviour = GetComponent<TrackableBehaviour>();
        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }

        OnTrackingLost();
        
    }

    #endregion // UNTIY_MONOBEHAVIOUR_METHODS

    #region PUBLIC_METHODS

    /// <summary>
    /// Implementation of the ITrackableEventHandler function called when the
    /// tracking state changes.
    /// </summary>
    public void OnTrackableStateChanged(
                                    TrackableBehaviour.Status previousStatus,
                                    TrackableBehaviour.Status newStatus)
    {
        if (newStatus == TrackableBehaviour.Status.DETECTED ||
            newStatus == TrackableBehaviour.Status.TRACKED)
        {
            OnTrackingFound();
        }
        else
        {
            OnTrackingLost();
        }
    }

    #endregion // PUBLIC_METHODS
    
        
            

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

        // Enable rendering:
        foreach (Renderer component in rendererComponents) {
            component.enabled = true;
            
        }
        
        AudioSource[] audioComponents = GetComponentsInChildren<AudioSource>();
        foreach (AudioSource component in audioComponents)
        {
                sfx_ovenover = (AudioSource)gameObject.AddComponent ("AudioSource");
                AudioClip myAudioClip;
                myAudioClip = (AudioClip)Resources.Load("SFX/Spisekammer/BilleOvenover");
                sfx_ovenover.clip = myAudioClip;
                sfx_ovenover.audio.Play();
            
            
            }
                
        Animation[] animationComponents = GetComponentsInChildren<Animation>();
        foreach (Animation animation in animationComponents)
        {
            
            animation.Play("SKbilleYellow");
            animation.Play("RHbugGreen");
            animation.Play("bugGreen");
            animation.Play("FKfliesAround");
            animation.Play("FKbottom2");
            animation.Play("Flieslort");
            animation.Play("FKbugsBrown");
            //Instantiate(bille1);
            //FKInst = Instantiate(FKInst);
            //FK_billerne = GameObject.Find("FK_billerne");
            //Instantiate (FK_billerne);
            
            }
        
        
        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
    }

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

        // Disable rendering:
//        foreach (Renderer component in rendererComponents) {
//            component.enabled = false;
//        }
        AudioSource[] audioComponents = GetComponentsInChildren<AudioSource>();
        foreach (AudioSource component in audioComponents)
        {
            component.audio.Stop();
            }
        
    Animation[] animationComponents = GetComponentsInChildren<Animation>();
        foreach (Animation animation in animationComponents)
        {
            
            

                 animation.Play();
                                    
                 animation.Sample();
    
                 animation.Stop();
            
                 animation.Rewind();
            
        
             
            
        }
        
        
        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost");
    }
    
    #endregion // PRIVATE_METHODS
}
 

 

 

Upgrade to v2.6.7 unity

August 19, 2013 - 12:31pm #4

When you state that that they are all visible, do you mean that all of the augmentations are rendered when any of the targets are detected? - or that it's now possible to detect all of the targets simultaneously?

Also are you seeing the same behavior on devices? - I wonder if the error in your Editor is corrupting the simulation.

There have been no changes to the QCARBehaviour that would cause this. Typically when you see the augmentations rendering by default, it's due to either an error in the event handler implementation or incorrect parenting of the models.

Perhaps you should try to modify the ImageTargets sample by importing your media into that - as it is a known-good example.

Upgrade to v2.6.7 unity

August 19, 2013 - 12:15pm #3

HI david thanks for your fast reply, started a hole new project and importeted my fbx files again, I use Unity 4.2 the newest version and now alle my imagetargets are visible

Is there any new change to the QCARBehaviour ?

 

Best

Daniel

Upgrade to v2.6.7 unity

August 19, 2013 - 12:06pm #2

Did you follow the steps in the migration guide? - https://developer.vuforia.com/resources/dev-guide/migrating-your-unity-project

Log in or register to post comments