Forum rules - please read before posting.

Transitional Animation States

Hi. I found this discussion on transitional animation states.

I want to do a similar thing in my 2D sprite based animation game:

My character walks with his hands in his pockets and should take them out of his pockets when he is standing around. He should then put them back in his pockets before walking again.
Also, part of his Idle animation involves playing with a Rubix cube. He should put this back in his pocket before walking again.

Can I set these transitional animation states up? How? By switching to the mechanim system of animation as mentioned in the linked discussion? Or is there another route?

Thanks!

Comments

  • The linked thread is very old - it's recommended to now use the "Sprites Unity Complex" animation engine for any 2D character who has special animations needs.

    The main issue here, however, is motion related - not animation. You're looking to actually delay the character's motion. Regardless of whether he plays animation during this time or not, this'll take some scripting to attempt.

    What kind of character is this? The Player character? And how is he commanded to move? Through point-and-click?

    The first thing to do will be to set up a way of what "idle" state he's in - i.e. hands by his pockets, or playing with a Rubix cube. How are you playing these animations? As one long clip, or via Animator parameters?

  • Hi Chris. Aha, OK. Sprites Unity Complex it is then...!
    Yes, it's the player character. He is commanded to move through point and click.
    At the moment I am playing the Idle animation as one long clip, but I am flexible - I don't know what Animator parameters are but will look into it and see how far I get.
    As ever, Thanks!

  • Yes, you'll need to be familiar with Animator parameters before going ahead with all this. This is a standard Unity workflow, so you can find lots of information on them in Unity's docs.

    AC's "Character animation (Sprites Unity Complex)" chapter covers how to make use of them to animate an AC character, and in /Assets/AdventureCreator/2DDemo/Resources, you can find a variant of the 2D Demo's player character that uses Sprites Unity Complex.

    I think the best way to "delay" a 2D character's movement while he prepares to leave the idle state would be to dynamically slow their movement speed to zero during this time.

    In Unity's animation window, it's possible to create Animation Events that can be used to send information to a script that's also attached to the same GameObject as the Animator that plays the animation. This'll be something else to read up on, but this should allow you to create events that dynamically alter the character's walk speed.

    For example, you could create an event that sends a float parameter to a function named "SetSpeed", and attach a script with the following:

    public AC.Char character;
    public void SetSpeed (float newWalkSpeed)
    {
        character.walkSpeedScale = newWalkSpeed;
    }
    
  • AH.... I see. Because otherwise the character will start to move across the screen before the 'Closing Idle' animation has been performed. I understand. Great, thanks. I will start digging...

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.