Search Unity

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