Search Unity

Smooth transitioning between walking and running

Discussion in 'Animation' started by daniel_lochner, Aug 2, 2018.

  1. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    171
    Hello everyone,

    I have currently setup my animations for my character (all of which were downloaded from the "Rifle 8-way" animation pack on https://www.mixamo.com) using mecanim, but I am battling to work out how to smoothly transition between the walking and running animation and vice versa. It does try to blend, but it really doesn't look great, with the player looking as if he is moon-walking a lot of the time.

    Thanks in advance,
    Daniel
     
    Last edited: Aug 2, 2018
  2. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    171
    Update: I finally solved my problem! My solution was to use two blend trees, "Walk" and "Run" within a single blend tree, "Locomotion". I then merged between the two states using a speed parameter, which I either increased/decreased when holding/releasing the shift key.
     
  3. Goatogrammetry

    Goatogrammetry

    Joined:
    Apr 27, 2017
    Posts:
    197
    Yeah thats how its supposed to be done. I have a few tips: First, a good animation set should have a 'walk in place' so your speed control isnt trying to blend between idle and walk. Second, the transition between run and walk isn't exactly a long smooth blend. In a horse, its either walking, trotting, or galloping (ignoring gaited horses). Canter is just a slow gallop, but its the same foot placement order overall. Humans only have two legs but we still 'switch' between walk, jog, and run. To be realistic you should set up a more complicated blend tree that has small transitions between the gaits and prevent your speed variable from hanging out too long in the transition zones. Its nice to have the different animations, walk, jog, and run with the same foot down on the same frame to ensure good blending.
     
  4. dudeehc

    dudeehc

    Joined:
    Jan 28, 2020
    Posts:
    2
    cool thanks!