• Games/Apps

  • Tools

  • Class

  • About

  • Blog

  • Mais...

    YGameDev

    Login do Webmaster
    Tech Art/VFX
    Gameplay Programming

    Basic: Match Target

    June 20, 2018

    |

    Yves "Jack" Albuquerque

    I use root motion to move my characters. In that way we avoid the terrible sliding effect that occurs when a character animation don't match a character movement.

     

    Sometimes, however, we need to turn it off in order to play animation maintaining our root where it is. There's several cases that this is used. The most usual case scenario is during aerial movements since the trajectory of our character don't change according to his movement (on most cases).

     

    However, a third case scenario exist. Maybe you want both things. So you can have some root motion but, at the same time, you want a specific result during this action. This specific result can be a specific root position/rotation at the middle of the animation, or a position for an specific part of your character.

     

    Too abstract? Let me give you some examples.

    Suppose that you are creating a climbing system. Your character is holding a ledge, he makes the jump movement from a ledge to another and, at the end of this aerial movement part, he is holding the other ledge. What if the other ledge position is not at a fixed distance?

     

    Using root motion you need an animation for each possible direction and distance what doesn't make any sense.

     

    Without root motion, you will need to compensate the entire movement using offsets related to the entire jump-to-a-new-ledge timeline. A lot of effort to a simple movement. 

     

    The way to go here is to detect when the player leaves the first ledge, lerp his position when executing the aerial part of the animation, and, match his hand with the next ledge exactly at the end of the aerial animation part.

     

    Unity Animator system give us a system for that using targets. You can specify a target (Hand, Foot, Root or Body) and track it`s position/rotation or, use a method called "MatchTarget" to do that.

     

    MatchTarget executes only the base layer and on the current animation state. You should pass the normalized start time and end time.

     

     

    I did another example using a Jump. You can download the code used on this example here.

     

     

     

    Please reload

    Featured Posts

    Basic: Animation Events

    July 27, 2018

    (Unity) Game Architecture

    March 7, 2017

    Basic: Animation Layer & Avatar Mask

    August 1, 2018

    1/8
    Please reload

    Recent Posts

    Basic: Realistic Eye Movement

    August 8, 2018

    Basic: Animation Layer & Avatar Mask

    August 1, 2018

    Basic: Animation Events

    July 27, 2018

    Basic: Avatar Muscle Settings for Animation Reta...

    July 14, 2018

    Basic: Unity Timeline 101

    July 4, 2018

    Basic: Root Based Movement

    June 28, 2018

    Basic: Match Target

    June 20, 2018

    Basic: Unity Animator Built-In Record/Playback S...

    June 14, 2018

    Basic: Unity IK

    June 6, 2018

    UX/UI for Virtual Reality

    March 25, 2018

    Please reload

    Archive

    August 2018 (2)

    July 2018 (3)

    June 2018 (4)

    March 2018 (1)

    September 2017 (1)

    March 2017 (1)

    February 2017 (2)

    January 2017 (1)

    November 2016 (1)

    August 2016 (1)

    July 2016 (1)

    May 2016 (1)

    April 2016 (1)

    July 2015 (1)

    May 2015 (1)

    March 2015 (1)

    Please reload

    Share