Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

smooth animator parameter change

Discussion in 'Animation' started by LouisFernandez, Sep 21, 2013.

  1. LouisFernandez

    LouisFernandez

    Joined:
    Aug 4, 2013
    Posts:
    10
    Hi community,

    i have a character controlled with buttons. After pressing the buttons the Animator.Speed value will be changed.
    The problem is that the transition of the animation is very hard. Probably cause of the constantly used Animator.SetFloat() function. When using arrow keys from keyboard it worked fine, but i dont want to use Input.GetAxis("Horizontal") for Animator.Speed value.

    I hope there is a solution

    br
    Louis
     
  2. LouisFernandez

    LouisFernandez

    Joined:
    Aug 4, 2013
    Posts:
    10
    hi guys,

    i found a acceptable solution. First point: there was a mistake in my code. I was reseting some Animator values to zero so that the animation has to restart all the time. But after solving that, it was still a hard transition of the animations. I used Mathf.Lerp to set smoothly the parameters of Animator.

    Louis