Search Unity

Is there a way to fix the amount of time that gets updated in the animations?

Discussion in 'Animation' started by MagicCancel, Jan 17, 2018.

  1. MagicCancel

    MagicCancel

    Joined:
    Jul 30, 2015
    Posts:
    25
    Basically, I want to make it so every frame, the animations think a static amount of time has passed.

    Example: I want to make animations update as .5 seconds a frame, and then a frame lasts 0.2 seconds, and then another lasted 0.1 seconds, but the animation will act as if 1 second has passed. Anyone know how to set that up?
     
  2. StickyHoneybuns

    StickyHoneybuns

    Joined:
    Jan 16, 2018
    Posts:
    207
    https://docs.unity3d.com/ScriptReference/AnimationState.html

    The only way I can see this working is by using AnimationState.normalizedTime.
    At each update call you can simply:

    void Update(){
    Animation anim
    anim["Walk"].normalizedTime = 0.5f;// 0 being the beginning of the animation and 1 being the end, 0.5 being the middle
    }

    I have never tried this but it should do what you want to do.
     
  3. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675