Search Unity

Driving Normalized Time with a parameter

Discussion in 'Animation' started by MitchC, Mar 27, 2018.

  1. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    I recently just found the feature where various settings in an animation state can be driven from a parameter. This is exactly what I've been looking for, but I'm not seeing the results I expect.

    What I'm trying to do is to scrub through an animation based on the value of a parameter. In this instance, it's a character drawing a bow to fire. We have a parameter called DrawBow, which lerps from 0 to 1 over a given time (we have different bows which we want to draw back at different speeds). We want this to control the normalized time of the animation where the character draws the bow string. So I've done this:

    upload_2018-3-27_15-33-35.png

    I've checked the 'Parameter' option next to Normalized Time, and pointed it to the DrawBow parameter. The trouble is, what I see in game is it immediately blending to the next animation, where the character holds the bow and full draw waiting to fire (the transition condition is DrawBow > 0.99). In the Animator window though, the blue progress bar on the anim state progresses at the regular rate, which is definitely not what's being seen on the character.

    As a test, I set it to use a parameter which is just sitting at 0, and it seems to behave as expected (sits on the first frame until it transitions to the next state).

    It's not just the character, either. The bowstring itself is being animated in the same fashion, and setting Normalized Time to the DrawBow parameter has the same result as on the character.

    Is this a bug? Or am I misunderstanding how this feature is intended to work?

    EDIT: I'm using Unity 2017.3.1p4

    EDIT2: Upon further investigation, I was mistaken about it immediately transitioning into the next anim. It appears to be entering the Draw anim, but beginning on the final frame, and just staying there until it transitions into the next state.
     
    Last edited: Mar 27, 2018
  2. MitchC

    MitchC

    Joined:
    Sep 9, 2013
    Posts:
    22
    For anyone interested, the problem seems to have disappeared, and I'm not sure why. I came back into work this morning, and it all seems to just magically be working? I don't know if it was restarting Unity or rebooting or what, but the animation playback now seems to be driven correctly by using a parameter for the Normalized Time.

    If anyone from the future has this issue and finds this post, I apologize that I can't give you a solution.
     
    theANMATOR2b likes this.