Log in or register to post comments

keep Object after Imagetarget

August 15, 2013 - 5:30am #1

Hello Community,

is there a possibility to keep the firmly positioned Object which are on the screen, after scanning an Imagetarget?
So in our application we are placing an object in the middle of the screen and after scanning an imagetarget we want to call a function without losing the object.

Hope for help
Louis

keep Object after Imagetarget

March 12, 2017 - 8:58am #5

how u do this ?  i'm not able to do ..?

 

keep Object after Imagetarget

August 19, 2013 - 3:07am #4

No problem - happy to help :)

N

keep Object after Imagetarget

August 18, 2013 - 4:09am #3

Hi Nalin S,

thanks for your quick respond. I will try this but i think your solution should work for my case.

Best Regards
Hannes

keep Object after Imagetarget

August 15, 2013 - 5:44am #2

You can achieve this by customising the DefaultTrackableEventHandler script which is attached to each Image Target.

At present in the OnTrackingFound()/Lost() methods this simply enables and disables each rendering/collision component for every child:

 

 

    private void OnTrackingFound()

    {

        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>(true);

        Collider[] colliderComponents = GetComponentsInChildren<Collider>(true);

 

        // Enable rendering:

        foreach (Renderer component in rendererComponents)

        {

            component.enabled = true;

        }

 

        // Enable colliders:

        foreach (Collider component in colliderComponents)

        {

            component.enabled = true;

        }

 

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

    }

 

Once you have the child game object that you require, you can do what you want with it, which is quite possibly to re-parent it so that it no longer belongs to the Image Target.

HTH

N

 

 

 

Log in or register to post comments