Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Animation Modify weight with animation clip?

Discussion in 'Animation Previews' started by Pr0x1d, Mar 16, 2020.

  1. Pr0x1d

    Pr0x1d

    Joined:
    Mar 29, 2014
    Posts:
    30
    Hello, Im trying to make a simple third person reload animation, where I animate hand going onto mag, then putting parent weight at 1 so the magazine moves with hand and then back. Problem here seems to be that animation wont change the weight of constraint for some reason, is there any way of doing it? tried making it with code but that gave me weird results... Also you can see that when I preview the animation it works fine... Thanks
     
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    131
    Hi,

    Previewing the clip while in playmode disables the Animator on which it is playing to prevent both animations (the preview and runtime) to play at the same time. I'm not sure what animation is playing when you're reloading the gun here, but having the Animator disabled will surely prevent your animated constraint from playing.

    Is it working if you toggle preview off? Otherwise, can you tell us on which version of Unity you're working on and which version of the Animation Rigging package you're using?
     
    Pr0x1d likes this.
  3. Pr0x1d

    Pr0x1d

    Joined:
    Mar 29, 2014
    Posts:
    30
    Hello,

    Trying to toggle it off did not work, however while I was testing it I checked the Animate Physics bool and it works now, for the info I am using 2020.1.0b1.3256 and Animation Rigging preview - 0.3.3.

    upload_2020-3-17_21-4-26.png

    If this is the solution can it be added to the documentation as I did not find anything about it just this one sentence which was telling me that it should work somehow.
    upload_2020-3-17_21-8-16.png
    (from: https://docs.unity3d.com/Packages/com.unity.animation.rigging@0.3/manual/RiggingWorkflow.html)

    Thank you very much for your help.
     
  4. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    131
    Hi,

    The 'Animate Physics' option is unrelated to Animation Rigging, but it forces animation to evaluate to a fixed time step, which is probably why it appears like it's working.

    More to the point however, the 'Animation' component is not compatible with Animation Rigging. You should only use an 'Animator' component if you're thinking of using Animation Rigging.

    I'm guessing you have nested an Animation component underneath an Animator component in your setup? I would be cautious when using nested Animation/Animator components when used with constraints as Animation Rigging reads back animated value from its animation stream, not its nested animation stream.
     
    Pr0x1d likes this.
  5. Pr0x1d

    Pr0x1d

    Joined:
    Mar 29, 2014
    Posts:
    30
    Hello,

    I tried putting the animation into Animator but that did not work aswell, there is also option to use Animation Physics which might do the trick, did not yet tried that one. Thanks for your help, I will be cautious and try to get it working with more reliable setup which you are suggesting.

    Thanks
     
  6. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    131
    Pr0x1d likes this.
unityunity