- Home /
Dynamic Animation Speeds
I'm building a 2D fighting game and creating attack animations using Unity's animator. For any given punch or kick players can do in my game, there are three important stats that pertain to the animation speed: the startup time (how long it takes for the attack to come out), the active time (how long the attack's hitbox stays out for), and recovery time (how long it takes for the player to regain control of their character). In order to be able to balance the game and rapidly iterate, I need control of all three of these variables.
I got a system working perfectly, but when it was time to start animating a character to throw punches, I quickly found that I needed a way to dynamically control the timing of different sections of a single punch animation. The other thing I could do would be to make 3 different animations for every attack, but I would still run into the same problem of having to manually adjust the timing of each animation to sync up with when the hitbox comes out. This would mean a bunch of tedious animation adjustments every time I made a small balance change. I also plan for players to be able to level up their stats RPG style, which the animator would have to know about at runtime to adjust its animation speed.
Is there a way to feed my various attacks' stats to the animator dynamically and let the code handle how fast the animation plays? I've looked around at tutorials but they mostly only explain simple, less rigidly defined animations like walking and jumping.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Animator Controller 2D RPG Best Practices 0 Answers
Best Way - Animation - Multiple GameObjects. 0 Answers
Create an idle motion with a 2D sprite. 0 Answers
Handling animation unity 4.3 2d game 1 Answer