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. Dismiss Notice

What is the Animator CrossFade "normalizedTransitionTime"?

Discussion in 'Animation' started by M6stafa, Sep 14, 2019.

  1. M6stafa

    M6stafa

    Joined:
    Aug 22, 2015
    Posts:
    1
  2. hugo-yu

    hugo-yu

    Joined:
    Nov 20, 2013
    Posts:
    5
    same question ...
     
  3. hugo-yu

    hugo-yu

    Joined:
    Nov 20, 2013
    Posts:
    5
    Unity doc about Animator.CrossFade is unclear and confused ...

    my guess:

    Animator.CrossFade(int stateHashName, float normalizedTransitionDuration, int layer, float normalizedTimeOffset, float normalizedTransitionTime);

    - normalizedTransitionDuration : normalized transition duration refer to current state
    - normalizedTimeOffset : normalized transition offset refer to current state
    - normalizedTransitionTime: normalized transition offset refer to target state
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,485
    I reported the issues with those documentation pages a few years ago and I'm entirely unsurprised to see that they have still done absolutely nothing about it.
     
    swingingtom and Zethros like this.
  5. ericqi

    ericqi

    Joined:
    Feb 5, 2015
    Posts:
    1
    2021/11/27
     
    RiesVriend likes this.
  6. KevinCastejon

    KevinCastejon

    Joined:
    Aug 10, 2021
    Posts:
    56
    17/06/2022
     
    yuukiandhisaxies likes this.
  7. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    2022-10-02
     
  8. engintech

    engintech

    Joined:
    Oct 22, 2022
    Posts:
    1
  9. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Define control. What are you trying to do?
     
  10. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    2022-10-05
     
  11. ETGgames

    ETGgames

    Joined:
    Jul 10, 2015
    Posts:
    88
    2022-12-02
     
    watsonsong likes this.
  12. lucbloom

    lucbloom

    Joined:
    Mar 27, 2020
    Posts:
    32
    It's super clear! It's the time of the transition, but normalized! Duh!

    This is what you get if you let Doxygen generate you documentation.
     
  13. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    Look at these functions. they have two parameters:
    normalizedTransitionDuration: The duration of the transition (normalized).
    normalizedTransitionTime: The time of the transition (normalized).

    I am not sure what the different between them.
     
  14. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,194
    Haha, this is just so typical for the Animator.

    "Normalized time" should just mean the duration expressed as a value between 0 and 1 - 0 is the start, 1 is the end. We use that all the time in our own animation system - asking for the current normalized time of an animation is pretty common in order to use as input to lerp functions or whatever.

    So normalized time offset for a cross fade makes a lot of sense - CrossFade with a .2 normalized duration would mean "the cross fade should take 20% of the duration of the animation to finish". Same for offset - how far into the animation do you want to crossfade?

    The only problem is... which animation? Is the normalized duration expressed as a normalized part of the source animation, or the destination animation?

    If you think about it, it can't really be the source animation, because Mecanim doesn't really have a concept of a source animation, or the "current animation" to blend from. What you're CrossFading from is the current blend of the animation graph, which can be any arbitrary blend of any number of animations. So the only sensible thing to use the normalized duration of is the destination state, because that's the only thing that's clearly defined!


    So, hey, I understood how this works after thinking about it because I've built an animation system. That's not going to be the case for the average reader of the Animator docs!


    @ChinnyBJ, Mecanim has been poorly documented for years. Every droplet of information about why something does what it does has required, if not a battle, then at least a skirmish with either bug reports or forum nagging before it's available.

    So big questions going forwards is;
    - Are you aware, internally, that the documentation is in fact lackluster?
    - Do you know why it's like this? What went wrong over the years for the API docs to end up where it is?
    - Are there plans in place for the new animation system to ensure that this doesn't happen again?