Search Unity

Character landing animation

Discussion in 'Editor & General Support' started by Metal Head, Nov 15, 2011.

  1. Metal Head

    Metal Head

    Joined:
    Aug 14, 2010
    Posts:
    411
    (can this thread be moved to the scripting section? I accidentally put it in the Support section)

    Basically every time the player lands on the ground from any kind of falling, he should play a landing animation but I have some logic problems.

    I found several threads about this, but they weren't really helpful to me.

    My player has a variable named "grounded". It is false when the player is in the air and it's true when he's on the ground. Every first frame when grounded changes from false to true, my landing animation kicks in. However I have some problems with this. My landing animation is just 2 frames - the player is just slightly crouched and doesn't move (the animation plays really fast). What I need to do is Crossfade to that animation when I touch the ground and when the crossfade is over and the animation is at it's maximum weight, I want it's weight to go back to zero so the idle animation will kick in.
    So basically the animation order will be: Falling -> Landing -> Idle. However, I have no idea how to make the Landing animation smoothly blend and then blend back in the short time after the player has touched the ground.

    Should I put the landing animation in another layer ?

    Can anyone help me with this one ? I just need some tips on how to deal with the logical part. :)
     
    Last edited: Nov 15, 2011