- Home /
Problem with door animation
Hi, I'm trying to make an automatic door but faced a problem with animation. I have a 2d unity proj(attached) with the example. I've created 1 animation for door oppenning and deselect "Loop" checker. Created an Animator with bool parameter "Open" that controls transition and added 2 door oppenning animation to it, one marked as "Mirror" and set up the scene.
But once I test it in game door starts closed ("Open" is set to false by defautl and "Door closed" is a default state in Animator). If player touches circle collider of the door it starts closing but before it's done opens again.
I'm pretty sure that I'm doing something wrong but can't find what excatly:)link text
I don't have time to play at the moment ,but I'm +1 your post because of the zipped project you added. It's a pity more people don't do that to save a swag of assumptions and additional clarification rebuttals.
I've not downloaded the project, but maybe test out just setting the bool true at runtime in the inspector and see what happens. If it works you can rule out the animation state controller you set up. Then start debugging logic... check for conditions that get rapidly called over and over creating a loop of open or closed conditions (like if the trigger is hit maybe it calls open then unintentionally calls close, then open again over and over). Good luck!
Answer by D3ltaVyyb · Dec 10, 2014 at 01:56 PM
Hello, It's great that you took the time to upload the example. So the problem is that you were trying the mirror boolean. I'm not sure myself how exactly mirror works, but you can uncheck that and instead reverse the animation by setting the speed to -1 on the closed state. In fact you can use a negative speed for any animation you want to reverse.
Thanks a lot, that helped! BTW, I've checked what's a mirror flag and it seems it just mirrors animation by X axis.