Flickering in animation transition

I made a video I made showing my problem visually: Ledge Grab Bug - YouTube


How you can see in it, there’s a frame where he plays the last animation for a couple of frames before grabbing the ledge. Would you have any idea about how to solve this?



Let me explain how my grabbing ledge code works: when the player is not grounded, I throw linecasts starting from the upper front of the collider, to detect a grabbable ledge in that area.

If a ledge is detected, I play the ledge grabbing animation (in which the pivot is positioned on the players hand) and then I move the player to the ledge by getting the bound values of the ledge collider by changing the player’s transform.position to its value.


If I delete the line that moves the transform, the animation won’t flicker


I’ve already tried:

  • Moving the transform using
    Translate()
  • Moving the rigidbody with
    MovePosition()
  • Checking if the falling animation
    isn’t being played again
  • Changing cameras
  • Changing the execution order of the
    animation and moving scripts

Thanks for the help.