- Home /
The question is answered, right answer was accepted
Starting a new animation, after stopping another. Without transitions.
I want to transition from an animation into moving the object normally, then later into another animation. So far I have two different "scenarios", both wrong: If I don't stop the animation, after it's done playing, I can't move the object. If I do stop the animation (Using: "this.GetComponent().Stop();"), I can't start another animation.
So it seems like the second scenario is the most promising, but why can't I start a new animation? I can't even start the same animation over! Ideally I would just trigger the same animation backwards, but I can't figure out how to do that either :I
In my animator window I have two states, one for each animation, and neither have any transitions to, or from them.
Edit: Pictures to better illustrate my issue: http://imgur.com/a/8Wljz
Edit 2: Problem solved here: https://www.reddit.com/r/Unity3D/comments/3mrr9p/starting_a_new_animation_after_stopping_another/ I'm such an idiot!
@$$anonymous$$r_FJ, you can have reverse animation by just setting the negative speed in the animation clip.
I tried that, but I couldn't get it work. Probably because of the rest of my problem. (Stop/start)
Answer by Mr_FJ · Sep 29, 2015 at 08:34 AM
I made a few pictures I hope better illustrate my issue :)
I find it hard to understand. XD 1. So you have a 3d model parented at a moving ParentObject.? 2. The model should stop its animations when the ParentObject moves? 3. Do you use mecanim? Because if you do you could set the move value as parameter and transition to an empty if the value is above 0 ( if it's moving).
Okay so the reason I specified it was a child of another, was because of world coordinates vs local coordinates, and the fact that it's position is not static, but maybe it doesn't matter. Basically when I click on the object in question, it animates for a bit (1), and then the animation stops. Then it is translated (2) to it's new spot (Not a set coordinate either) It stays at that location (3) until the user clicks on it again. Then it is moved back to the second position (4). Then it is animated back to it's starting position.
Oh and I'm using the animation system in unity 5.
Edit: Does this make more sense? http://imgur.com/SiCPG1m
Do you move it via code? Or via animator with apply root motion? Because I dont see a problem a click would just call a trigger in the new animation a longer touch or hover would set a bool and you could just handle the animation via the mecanim animation system of unity 5. So you dont have to stop it ever via code! In fact you should try to never stop the animator via code. You have to give him more parameters maybe and control him with those.
I would have 3 states: NoAnimstate / Touched / and maybe a move if you move the object via animation but i dont think this is the case here.
Follow this Question
Related Questions
Automatically playing animations 1 Answer
Animator Start and Stop Animations 0 Answers
ANimation doesn't rewind on animation.Stop 3 Answers
Stop Watch start when told 2 Answers
Animator Stop and Start 1 Answer