Log in or register to post comments

Start animation onTrackingFound and restart on another time

February 20, 2016 - 8:48am #1

I'm trying to start animation when the ImageTarget is founded and another time when the same target is founded it should restart. I'm using this code in DefaultTrackableEventHandler under onTrackingFound:

Animation[] array = mTrackableBehaviour.GetComponentsInChildren<Animation>(	false);
		foreach (Animation r in array)
		{
			r.Rewind();
		}

But it doesn work - animation starts when the app starts and stops at end. Please help!

Start animation onTrackingFound and restart on another time

August 13, 2018 - 12:23pm #3

Could someone explain this to a dummy?

Do I need to edit the DefaultTrackableEventHandler.cs script?

I tried this, but it did not work ....

 

Tks

Start animation onTrackingFound and restart on another time

July 13, 2016 - 12:00am #2

Try this it work like charm

private void OnTrackingFound()

{  

// I have added this code to restart animation when marker found

            Animator[] animatorComponents = GetComponentsInChildren<Animator>();

            foreach (Animator anim in animatorComponents)
            {
                anim.Play("Take 001", -1, 0f);
                Debug.Log("***anim component: " + anim.name);
            }

            // Enable rendering:
            foreach (Renderer component in rendererComponents)
            {
                if (component.name != "Video" && component.name != "Icon")
                {
                    component.enabled = true;
                }
            }

}

Log in or register to post comments