1
\$\begingroup\$

I've got a 2D character that's going to climb up a 2D tile to his left or right and I've got a climbing animation consisting of three parts essentially:

  • Animation for the character going from walking onto the ground -> climbing on the wall
  • The actual climbing animation when on the wall
  • A "climbing over the top" animation for where the character pulls himself over the top of the wall and onto the ledge above.

What is the smoothest way to handle this in Unity? Do I need three separate animation clips for each of the steps, or can I do it with one and simply loop the middle section of the clip?

For example, my initial thought would be to have one clip for the entire animation and do the following:

  1. play the first few "climbing onto the wall" frames when climbing onto the wall
  2. loop the actual climbing animation while the character is on the wall and isn't ready to climb over the top
  3. transition to the final few frames when the character is ready to pull himself over the top

Is this easily doable in Unity? Or is there an easier way to do this that I'm not thinking about? This seems a bit contrived and decently complicated so that's why I'm wondering.

\$\endgroup\$
0
\$\begingroup\$

From my experience recently in doing a few 3D animations, I found it very simple to just split up the animation into 3 separate clips. That way I felt that it was quite intuitive and easy when creating transitions between each animation clip in each stage of the overall animation. You also have a great deal more control over the animation transitions using this method.

If you split the animation up then just ensure that when you import the animations that you check the Loop animation check box in the Animations tab for the middle climbing animation clip and you should be good to go.

You can then also use State Machine Behaviours to drive any additional actions like playing sounds or effects etc during each clip.

I'm sure you could also perform some complex looping logic as you allude to, however that seems unnecessarily complicated and error prone in my opinion.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.