Log in or register to post comments

show me right step

November 12, 2013 - 1:54am #1

hi all,

 

i have researched n learned n tryout the cloud regonition using the video tutorials n some forums.

the problem is im not sure how to do it step by step on how to make one.

how to differenciate between markers n objects associate with it?

is this the correct way on how to do the metadata?

n assign it on the script. see attached image for an example.

https://developer.vuforia.com/sites/default/files/problem.jpg

thanks

 

 

AttachmentSize
Image icon problem.jpg290.89 KB

show me right step

November 13, 2013 - 11:25pm #5

thanks again for d reply NalinS

 

I am using UnityPro using the latest version 4.2.2

I will try to check for d debugger but i want u to make sure if the script that i did was right?? see below:-

           
        if( augmentation != null )
            augmentation.transform.parent = newImageTarget.transform;
 
        // enable the new result with the same ImageTargetBehaviour:
        ImageTargetBehaviour imageTargetBehaviour = mImageTracker.TargetFinder.EnableTracking(targetSearchResult, newImageTarget);
         
        Debug.Log("Metadata value is " + model_name );

switch( model_name ){

case "markerXshowme" :

GameObject.Find("object_Car").renderer.enabled = true;
GameObject.Find("object_Traffic").renderer.enabled = false;

//Destroy( imageTargetBehaviour.gameObject.transform.Find("object_Car").gameObject );

break;

case "markerYshowme" :

GameObject.Find("object_Car").renderer.enabled = false;
GameObject.Find("object_Traffic").renderer.enabled = true;

//Destroy( imageTargetBehaviour.gameObject.transform.Find("object_Traffic").gameObject );

break;

}

 

So im using "markerXshowme" (see above)  to look for the metadata value from the text file "metadataX.txt" that contains "markerXshowme" that i have uploaded to the cloud target manager. Im also using "markerYshowme" (see above)  to look for the metadata value from the text file "metadataY.txt" that contains "markerYshowme" that i have uploaded to the cloud target manager. So it should only show which object to be display on which marker correspondingly either "object_Car" will show at "markerXshowme" marker only or "object_Traffic" will show at "markerYshowme" marker only.

hope u get what i mean. sorry if my english is not quite good.

let me know which part of d script that i need to change. im quite a newbie in C# tho, hope there's a way to fix this problem.

thanks

show me right step

November 13, 2013 - 3:32am #4

when i test it out the marker shows both objects 'object_Car' & 'object_Traffic'

Unfortunately you will just have to step through the Unity debugger to work out what the problem is and why this is happening.

Best to do this in Play Mode if you have Unity Pro, otherwise you will have to do this on device.

 

N

 

show me right step

November 12, 2013 - 7:47pm #3

hi NalinS thank you for ur reply.

i've read the threads n im still kinda stuck on how to show my object.

and also differenciate for different markers & objects that will be displayed

example:

the MarkerX should only show object_Car.obj in 3D trough metadata metadataX.txt (from target manager) which contains markerXshowme

the MarkerY should only show object_Traffic.obj in 3D trough metadata metadataY.txt (from target manager) which contains markerYshowme

 

here is the C# script taken from the tutorial "SimpleCloudRecoEventHandler.cs":

    public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult)
    {
        // duplicate the referenced image target
        GameObject newImageTarget = Instantiate(ImageTargetTemplate.gameObject) as GameObject;
         
        GameObject augmentation = null;
         
        string model_name = targetSearchResult.MetaData;
         
         
        if( augmentation != null )
            augmentation.transform.parent = newImageTarget.transform;
 
        // enable the new result with the same ImageTargetBehaviour:
        ImageTargetBehaviour imageTargetBehaviour = mImageTracker.TargetFinder.EnableTracking(targetSearchResult, newImageTarget);
         
        Debug.Log("Metadata value is " + model_name );
         
         
         
        switch( model_name ){
             
            case "markerXshowme" :
                 
        	GameObject.Find("object_Car").renderer.enabled = true;
			GameObject.Find("object_Traffic").renderer.enabled = false;

                //Destroy( imageTargetBehaviour.gameObject.transform.Find("object_Car").gameObject );
                
                break;
             
            case "markerYshowme" :
                 
       		GameObject.Find("object_Car").renderer.enabled = false;
			GameObject.Find("object_Traffic").renderer.enabled = true;	
			
                //Destroy( imageTargetBehaviour.gameObject.transform.Find("object_Traffic").gameObject );
             
                break;
             
        }
 
        if (imageTargetBehaviour != null)
        {
            // stop the target finder
            mCloudRecoBehaviour.CloudRecoEnabled = false;
        }

 

when i test it out the marker shows both objects 'object_Car' & 'object_Traffic'

where am i doing it wrong? am i calling the metadata the right way?

 

is there any sample code where i can only show 'object_Car' from the MarkerX

https://developer.vuforia.com/sites/default/files/problem.jpg

 

i want it to work something like from the video tutorial on the 07min50secs

http://www.youtube.com/watch?v=9tksyhVlIMQ

 

show me right step

November 12, 2013 - 3:51am #2

You are on the right lines but you need to look at the Cloud Reco sample in more detail, and specifically the CloudRecoEventHandler script.  This should show you that the way to reference metadata is something like this:

if(targetSearchResult.MetaData == null)

...where targetSearchResult is a member of TargetFinder.

Also if you check out this thread I posted up a very simple CloudReco event handler that simply displays an object.

https://developer.vuforia.com/forum/cloud-recognition/creating-my-books-json-ios

HTH

N

Log in or register to post comments