- Home /
Play death animation while moving
Hello guys so after a lot (A LOT) of struggle i finally managed to get the basics of Animator down but i still have one problem that i cant just get down.So my problem is that:
My enemy is moving but after certain point i want it to die
if (health <= 0) { anim.SetBool("mires",true); yield WaitForSeconds(1); Destroy (gameObject);
its fine enemy gets to 0 health then dissapears and in Animator i set condition boolean to transition to death after bollean mires (dead) sets to true. My problem is that it dies in the same spot it just flies to starting point and dies there (starting of moving animation) it is child of empty game object moving Works fine in that regard it moves from the position of empty game object but it seems that if i uncheck has exit time it still finishes animation by that i mean it just goes to the end of it instantly but i want it to stop the animation at the exact spot the enemy is and then start another how do i do that (please no overly complex explanation iam pretty new at programming)
just in case i tried to do it with another layer and overriding it doesn't seem to help.
I kinda solved it by creating float assigning it to move animation as speed parameter and setting it to 0 before i issue mires true it stops and dies then gets destroyed from script attached to animation mirk (die) so its fine but its really overly complex and doing this for every name will drive me insane so if someone has better suggestions please let me know.
Your answer
Follow this Question
Related Questions
Check animator animation finished? 1 Answer
Death Screen on Current Scene, 1 Answer
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers