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

Question how to make animation update less frequently?

Discussion in 'Animation' started by Zimaell, Feb 10, 2024.

  1. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    425
    Tell me how to make the animation update less frequently?

    The situation is simple, those models that are close are updated as usual, and those models that are far away are updated not every frame, but let’s say 10 times less often, it will not be noticeable far away and at the same time you will see what is moving.

    Just how to do it?

    (animation humanoid, not root motion)
     
  2. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    425
    at least some direction?
     
  3. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,565
    The Animator component uses a PlayableGraph to progress through animations. According to the docs, a PlayableGraph supports a "manual" update mode where you specifically tell it when to update from a script call.

    However, the Animator component itself does not have an update setting which corresponds to this manual update mode. It would be really nice if it did, but there's probably a lot of downstream effects that cause problems for the AnimationController class if you jump forward through time in larger increments.

    I have noticed exactly the behaviour you're describing in several Unreal games and some big Nintendo games like TOTK.

    Perhaps @Kybernetik has some further insight, he made the Animancer asset which does a lot of under-the-hood manipulation of these things.
     
  4. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    425
    I came across a variant of an animator on Dots, the meaning is this - all transforms are placed in an array and each frame is read, that is, on what frame what object should be in what position, so if you don’t update this reading every frame, you will get the desired effect, but that’s me so I guess...

    So I’m thinking of trying to make this option (like in Dots) or is there a more acceptable option, I just also noticed that many AAA games use this effect, the only question is how exactly...
     
  5. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,698
    From what I've been able to find on the Internet you just pause the Animator with
    Animator.speed = 0
    and then you just call
    Animator.Update()
    whenever you want to update it.

    https://gamedev.stackexchange.com/questions/197869/what-is-animator-updatefloat-deltatime-doing
     
  6. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    425
    this is not entirely true, it will move either slowly or jerkily, but the point is to know where the bone will be after 5 frames (for example), but do not update it during these 5 frames, but already on the 5th frame put it where it is and it should have been if these 5 frames were updated... something like this...
     
  7. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,698
  8. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,565
    That math looks really annoying. Calculating the time shift in normalized time on the clip that happens to be playing? Yikes.
     
  9. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,593
    Animancer's Update Rate Example demonstrates exactly what OP is looking for. The
    LowUpdateRate
    script in the Overview section has all the main logic, just replace the
    PauseGraph
    /
    UnpauseGraph 
    with controlling the
    animator.speed
    and the
    _Animancer.Evaluate
    call with
    animator.Update
    and it should work the same.