Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Forward dash movement during attack animations

Discussion in 'Open Projects' started by rcarag, Jul 7, 2021.

  1. rcarag

    rcarag

    Joined:
    Feb 11, 2016
    Posts:
    5
    Hi. I added a slight forward dash movement in the attack animations.

    Pull Request: https://github.com/UnityTechnologies/open-project-1/pull/472



    The amount of dash movement can be customized within the Animation window, by using keyframes to change the value of
    Dasher.dashMagnitude
    .

    I used this approach because it gives the designer frame-by-frame control of the dash amount, and can easily be synced to the character animation. It's also way easier to tune, in contrast to using some kind of root motion baked into the animation.



    The yellow line and wire sphere at the foot of the character is used to visualize the dash amount that will be applied during that frame.



    The Dasher component doesn't actually do anything by itself, it just stores and exposes the
    dashMagnitude
    value.

    The actual dash movement is done in the state action
    AddDashMovementActionSO
    . It just adds the computed
    Dasher.DashMovementVector
    property to
    Protagonist.movementVector
    . For this to work,
    AddDashMovement
    must be added to the appropriate states in the transition table. To avoid jerky movement, I had to add it to the following states: Idle, Walking, IdleAttacking, and WalkAttacking.

     
    Last edited: Jul 7, 2021
    Amel-Unity and cirocontinisio like this.
  2. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Very interesting implementation! I really like the debug sphere you added that shows the potential movement during an animation clip. Good job :clapping emoji: