- Home /
Change animation depending on an angle the character is facing? (2d)
Hello! I'm totally new to Animation, and I have a question.
I have a character sprite divided into 6 other sprites (Head, body, hands, legs).
I would like to make a walking animation. Let's assume that walking animation only contains rotation of legs. It is made with curves and, for example, lasts for 2 seconds. At the 1 second point rotation approaches 90 degrees and then returns back to zero, for the first leg. For the second one, the same happens, however it approaches -90 degrees.
And now, the problem itself. This animation only works if character walks right. And I want it to work without problems while character is facing any direction! So, let's assume that it will work perfectly, if those 90 and -90 degrees were multiplied by a Sin of the rotation angle.
I actually just thought of a solution. Create a new script, which will contain public raw rotation values, multiply them by sin of angle and then rotate parts of a body, and then make the animation change these and not the angles themselves. However, is there a better way to do that?
Thank you for your help!
Your answer
![](https://koobas.hobune.stream/wayback/20220613060544im_/https://answers.unity.com/themes/thub/images/avi.jpg)