Search Unity

Locomotion System Advanced Jumping Animation

Discussion in 'Editor & General Support' started by deckard, Oct 12, 2012.

  1. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    I am working on the jump animation of my character and I would like to make it a bit more polished than what most games do. So I asked our animator to add a prejumping movement and a landing movement in the jumping animation.
    I have then divided this animation in three parts:
    - "prejump": roughly the first half of the animation
    - "jump": starting at the frame when the feet should lift off the ground
    - "land": starting at the frame when the feet should touch the ground again

    Our animator has also created a "freefall" looping animation to be triggered if the character is in freefall for more than 0.5s

    I have setup a new locomotion group called "locomotionPrejump" containing the "prejump" animation as "grounded" (so its Native Speed = 0) and another new locomotion group called "locomotionLand" containing the "land" animation as "grounded" (so its Native Speed = 0).

    - When the player hits the jump button, the character switches to "PreJumping State": the animation of the character is crossfaded to "locomotionPrejump".
    - After a delay, the character switches to "Jumping State": the vertical speed of the charactercontroller is increased to make it actually jump and the animation of the character is crossfaded to 'jump"
    - if necessary the characters then switches to "Falling State" and the animation of the character is crossfaded to "freefall"
    - When the character touches the ground again, it switches to "Landing State" and the animation is crossfaded to "locomotionLand"
    - Finally the character switches back to "Normal State" and the animation is crossfaded to the standard "locomotion" group.

    It took me quite some work to fine tune every settings but the above system works very very well... when the character is in idle animation (or only walking very slowly) at the time the jump button is pressed.

    But it doesn't work as well if the character is walking (and it is of course worse if the character is running). Because since the "prejump" and "land" animations are "grounded", the character comes to a short halt before and after jumping.

    I now would like to add a series of specific animations (prejump, jump, land) to be used when the character is walking and/or running. So that the jump movement blends seamlessly without the character alting before and after jumping. In addition, I would like to make sure to use different animations depending on which foot the character is when the jump button is pressed.

    So I should end up with the following animations list:
    - walkrightprejump, walkrightjump, walkleftland (if the character jumps while on the right foot, he will land on the left foot)
    - walkleftprejump, walkleftjump, walkrightland
    - runrightprejump, runrightjump, runleftland
    - runleftprejump, runleftjump, runrightland

    Is there a way to setup the "locomotionPrejump" and "locomotionLand" groups with additional "prejump" and "land" set as "walking cycle" although they are not cycling animations?

    Shall I create several "locomotionPrejump" groups and "locomotionLand" groups, considering that each animation will be doubled (one animation for each foot)?
     
    Last edited: Oct 12, 2012
  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    The Locomotion System doesn't handle moving non-cyclic animations so you'll have to handle those with your own scripting I'm afraid. Add them to the "non-handled" group in the Locomotion System (where they are by default if they're not in any other groups) and then control their weight and time with your own code.

    Rune
     
  3. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Thanks a lot for this clarifying this.

    Is there anyway to let an animation of the "non-handled" group benefit from the IK solver of the Locomotion System?
     
  4. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    No.

    Rune
     
  5. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Well that's very unfortunate. My character is constantly walking on uneven terrain so it wouldn't be possible to just play an animation without IK.

    IMO a perfect feet animation without skating and with IK on the limbs is a must have in any current gen game. So I wouldn't consider getting rid of the Locomotion System for my game.

    Have you ever thought about expanding the functionalities of the Locomotion System for non cycling animations?
     
  6. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Unity 4 introduces the new Mecanim animation system that's not compatible with the Locomotion System. The current/old animation backend will be deprecated and gradually phased out. So continuing development of the Locomotion System is not going to happen.

    A better idea would be to have support for some kind of foot placement system on top of the Mecanim system. In 4.0 the Mecanim API doesn't expose enough low-level control to make that viable, but maybe sometime in the future.

    Rune
     
  7. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    So basically, although Mecanim will globally improve the Unity character animation system, we'll see a downgrade in foot placement with this new version of Unity?...
     
  8. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    Depends on how you see it. Unity 3.x never had a built-in solution for foot placement. Unity 4.0 won't either. The Locomotion System does foot placement (and a bunch of other stuff) for the "old" system. For a start there won't be such an extension available for Mecanim, but if it's important to you, you can still use the legacy animation system and continue to use the Locomotion System that way, at least for some time. If you find that a foot placement solution is important to have for Mecanim, I'd suggest you suggest it at our feedback site.

    Rune