Log in or register to post comments

Animation is not playing on target found

August 3, 2015 - 6:25am #1



i know i know ... a question you may have read alot of times. Why isnt my model moving on target found? ☺

I tried nearly every constelation i found suggested in this forum but none of thme worked. 

The Animation is running when i loop it, but because I want to sync it with audio I on target found it must not be looped.

(FBX Object with baked Animations)


My Workflow :

I drag my model into the scene into an objectTarget Object. 

The Object itself gets an AnimatorObject (instance? however)

but it has no controller and i cant see the clips ( I can see the clips in the Assets folder in the subtree of the model )

So i drag the clip to the Model and it get a controller and in the Animator view the clip apears. 


I added a script to the Object Tracker 

using UnityEngine;
using System.Collections;
using Vuforia;

public class NewBehaviourScript1 : MonoBehaviour, ITrackableEventHandler 

		private TrackableBehaviour mTrackableBehaviour;
		Renderer[] rendererComponents;
		Animation[] animationComponents;
		void Start()
			rendererComponents = GetComponentsInChildren<Renderer>();
			animationComponents = GetComponentsInChildren<Animation>();

			mTrackableBehaviour = GetComponent<TrackableBehaviour>();

			if (mTrackableBehaviour)
		public void OnTrackableStateChanged(
			TrackableBehaviour.Status previousStatus,
			TrackableBehaviour.Status newStatus)
			if (newStatus == TrackableBehaviour.Status.DETECTED ||
			    newStatus == TrackableBehaviour.Status.TRACKED ||
			    newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
				// Play audio when target is found

But the model is not moving on Target found. 

I tried adding an animation component to the Model and selected the clip. not working..

I tried adding an animation component to the ObjectTracker and selected the clip. not working..

I tried using the Animator (but i a mnot sure how to use it in the script to "trigger" the animation clip.

I read a lot of forum entries and even whatched the tutorial videos about the animator and the scripting and

tried many different ways but none of them brought me to the final goal to just play the animation when the 

target is found (like the audio does) and stop it whe the target ist lost (like the audio does)

It play the animation when i hit the play button in unity.


I am on Android 5.1 (Jiayu S3)


Pleas help. =)













Image icon 1.JPG143.95 KB
Image icon 2.JPG131.21 KB

Animation is not playing on target found

April 17, 2018 - 6:02am #5

Thank you, I appreciate you for sharing the solution (not a coder here). So it's helped heaps, cheers!

Animation is not playing on target found

November 8, 2015 - 11:52pm #4

how did you do it can you show me your code? thanks

Animation is not playing on target found

August 10, 2015 - 11:06am #3

HI Thanks for the Answer.. 

I figured it out by myself. 

I had to access the animator of my johnny bravo object .. The GameObject is the Object / Image Target but the Animator is on the Johnny Bravor object (only then i can see the animation)

So i have to access the animator not with getComponent<Animator>(); BUT with 


anm = GetComponentInChildren<Animator>();

and then 



AHA! And it worked! Yay°!



Animation is not playing on target found

August 4, 2015 - 5:09pm #2


Try as a test adding a Button so when you press it, it plays the animation and sound. See if that works.

Try also having just one database with one target and containing in that target the code you posted.

Log in or register to post comments