Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AnimatorStateInfo can't "set" normalizedTime

Discussion in 'Animation' started by MFestiniMagiaDigital, Jan 10, 2017.

  1. MFestiniMagiaDigital

    MFestiniMagiaDigital

    Joined:
    Dec 2, 2016
    Posts:
    2
    As the title states, i'm trying to syncronize newly created 2d sprites based on another 2d sprites already created (like new tiles of sea to previously created ones).

    I'm using AnimatorStateInfo that as far as i'm concerned is based on the AnimationStateInfo, the only difference and annoyance i've found is that for AnimatorStateInfo, the normalizedTime variable is only gettable unlike the AnimationStateInfo where you can set/get it

    So my doubt is....... Is there ANY WAY to make normalizedTime variable setteable? All i want is:
    a.normalizedTime = b.normalizedTime

    Thanks in advance
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Siliko likes this.
  3. MFestiniMagiaDigital

    MFestiniMagiaDigital

    Joined:
    Dec 2, 2016
    Posts:
    2
    Thanks a lot for the reply,
    I tried doing what u told me, yet i can't get them to sync properly

    On the same frame that the tile is created, it's normalized time is 0
    And on the next frame u can clearly see that both normalized times are not the same Screen Shot 2017-01-10 at 12.27.35 PM.png
    Resulting in the tiles to become like this
    Screen Shot 2017-01-10 at 12.28.23 PM.png

    When do i need to call the method so both normalized times are the same?

    PD: I'm creating X number of tiles so i need a solution that needs to be done when creating or after creating them but doesn't need to change the previous tiles created (72 created and creating 8 more that need to sync based on that, to give an approximate)
     
  4. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Can you show us your script? it hard to help you without seeing any code
     
  5. Bubsavvy

    Bubsavvy

    Joined:
    Sep 18, 2017
    Posts:
    48
    Why have you guys made it so difficult to deal with the animator? Clearly this is an issue... We want to do the same thing and have the same problem. Play & CrossFade do NOT apply the target normalized time offset until the next frame. Making it impossible for us to sync states with 100% precision. Mechanim is not the answer here, because the tools you have provided us for layer syncing are useless. We want to sync individual states and states with blend trees, not all states on a separate layer. With an UPPER and LOWER body layer with masks a majority of the states are the same minus the additional states used for attacking that exist in the upper body layer. The old system provided us more control to be honest. Adding another param and assigning it to normalized time on the mechanim state as well is hardly a solution. Rant over.
     
  6. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    It sounds like you might be interested in Animancer (link in my signature). It lets you avoid using Animator Controllers and gives you direct control over everything, including speed and time as shown in this example.
     
    Bubsavvy likes this.