Search Unity

Blendtree float glitch

Discussion in 'Animation' started by SammmZ, Mar 24, 2020.

  1. SammmZ

    SammmZ

    Joined:
    Aug 13, 2014
    Posts:
    174
    I get a weird animator behaviour. When animator's float reaches zero value - related blendtree start glitching with completely random numbers unless you don't manually set 0 to animator's float. I have animation events attached to movement animation and they start fire insanely even while the character is standing idle. Did anyone ever saw this? https://gyazo.com/efa4b35e092e4d431e92a340098813f1

    A similar case was mentioned once, but I'm not sure it gets any attention. https://answers.unity.com/questions/1396276/animation-blend-tree-value-glitching-after-reachin.html
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    It might be related to the Time Synchronisation that Blend Trees do. As the parameter approaches zero, the weight of the walk animation will approach zero but it will still trigger its events normally, however the synchronisation could potentially be drastically changing its time since its low weight means it has little say in the synchronised time calculation.

    The obvious workaround is to just skip to zero if you get into really small values. That will also have a performance benefit because every change to the parameter causes it to recalculate all the weights in the Blend Tree (pretty fast for 1D Blend Trees, but still a cost). Maybe you could make a script that swaps between 0 and 0.01 every frame to see if you can actually see any real effect from it so you can narrow down an appropriate threshold below which you can't tell the difference anyway.
     
    SammmZ likes this.
  3. SammmZ

    SammmZ

    Joined:
    Aug 13, 2014
    Posts:
    174
    Ha-ha, that's exactly what I did - set my variable to be always = value+0.01f
    But I still feel disappointed, that's not what I expected from the simple blend tree