Log in or register to post comments

Play animation only once

February 22, 2013 - 4:05pm #1

Hello!

How to get animation played only once when target is found? For now I'm using animation.Play and Stop function on defaulttrackableeventhandler.cs script. When target is lost, 3D object dissapears, but when target is found, animation starts from beginning, but this is wrong. Animation is a growing 3D city, so what I'm trying to get is to play animation only once after first time, when marker was found. I'm stuck on this, because function animation.Play under onTrackingFound() starts animation from beginning every time when marker is founded.

Play animation only once

February 23, 2015 - 1:13pm #7

Hi, did you fix this problem, OnTargetFound play just once the animation?

Play animation only once

November 11, 2014 - 3:12pm #6

Not so sure, dont have Unity in front of me, but you could try this; select the animation clips (*anim), uncheck the 'loop'.

Play animation only once

November 11, 2014 - 4:12am #5

The animation i did inside UNity, key frame animation.

I does not work with animation made it inside UNity?

Play animation only once

November 10, 2014 - 11:01pm #4

If your animation came together with yr .fbx or any other format, check to see if the animation was set to loop when you import it to unity. 

Play animation only once

November 10, 2014 - 6:27pm #3

Hi, how did you get the animation played only once when target is found ?

Im trying but I'm not getting. Can u help me please?

Play animation only once

February 24, 2013 - 8:31am #2

 

You can set the time of the AnimationState - http://docs.unity3d.com/Documentation/ScriptReference/AnimationState.html

You can also pause the animation, rather than stop it, but setting the speed to 0. Try this first, it's a little easier to implement.

To track and set the time, you'd need add a variable to your event handler that stores that animation time when the target is lost and is then used to reset the time when the target is found again.

Log in or register to post comments