Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Set animation curves default value or remove value smoothing

Discussion in 'Animation' started by davidrochin, May 1, 2019.

  1. davidrochin

    davidrochin

    Joined:
    Dec 17, 2015
    Posts:
    67
    Hi! I'm having a problem with animation curves values.

    I'm controlling the speed of some of my animations by setting Animation Curves to them in Import Settings like this:

    upload_2019-5-1_14-47-6.png

    It works, but there is a problem. When an animation clip doesn't have that curve, the value defaults to zero. This causes a problem because, it seems like the value is smoothed.

    Right now, the only animation clips I applied curves to, are attack animations. Most (if not all) of them start and end with a value of 1 (or close):

    upload_2019-5-1_14-51-5.png

    However, because the default value is 0, and because it seems the value doesn't change instantly (is smoothed), the animation plays like this, if it is played after an animation with no speed curve (notice the difference at the start):

    upload_2019-5-1_15-5-19.png

    So, to solve this I need to do one of two things:
    1. Tell Unity that the default value of "Curve/Speed" should be 1. (I don't know how)
    2. Tell Unity to not smooth curves values. Instead, instantly change the values. (I don't know how)
    3. Add animation curves to ALL of my animations (too time consuming, I got hundreds of them and they can be played in several combinations)

    Does somebody have an idea to solve this?

    Thanks for reading
     

    Attached Files:

  2. davidrochin

    davidrochin

    Joined:
    Dec 17, 2015
    Posts:
    67
    I found the solution. Unity takes the starting value of the animator parameter as its default value. I just had to set it to 1.0 and now that is the value Unity gives to it when there is no Curve data
     
    Last edited: May 2, 2019
    Reticulatas and Uristenzor like this.
  3. Quadropups

    Quadropups

    Joined:
    May 23, 2017
    Posts:
    18
    Thank you for posting the solution!
    Was gonna ask the very same thing.
     
    Uristenzor and davidrochin like this.