Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Animancer - Less Animator Controller, More Animator Control

Discussion in 'Assets and Asset Store' started by Kybernetik, Oct 8, 2018.

  1. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    @Ryirs Cycle offset is a normalized value, so you want 0.5. Using 12 would be the same as 1 or 0.

    @FairyMental Check the AnimancerComponent in the Inspector. Behaviour like that is often caused when the total weight of all your states adds up to more than 1, which shouldn't happen under normal circumstances. If that doesn't help you track it down, feel free to send a minimal reproduction project to animancer@kybernetik.com.au and I'll take a look at it.
     
    Ryirs likes this.
  2. Leslie-Young

    Leslie-Young

    Joined:
    Dec 24, 2008
    Posts:
    1,148
    It is something that can be disabled in the package manager which some like me would like to do when the game has noting to do online. Maybe that influence it for editor scripts too. Don't know how this can easily be resolve without a directive defined by Unity to check against. At least deleting the script works.
     
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Since Animancer's ReadMe only uses it in the Editor Unity should be able to strip that package out of runtime builds, but I actually did find a proper way to handle it. The Version Defines section in an Assembly Definition lets you specify a Resource (a package like com.unity.modules.webrequest) and a Symbol (UNITY_WEB_REQUEST) then scripts within that Assembly Definition will have the Symbol defined whenever the specified package is present, meaning I can then use #ifs to cut out the bits that actually use web requests. So it won't be an issue in future versions of Animancer.
     
    Leslie-Young and hopeful like this.
  4. Leslie-Young

    Leslie-Young

    Joined:
    Dec 24, 2008
    Posts:
    1,148
    Ah nice, was wondering how they did it in some other packages where I saw a directive related to webrequest which did not seem to work when I tested it on the readme script.
     
  5. daenius

    daenius

    Joined:
    Sep 7, 2021
    Posts:
    11
    Any possibility of making "Playablemancer"? Been using Timeline with other Playables and after making myself a custom track to control Animancer so I can sync of all that in one graph it dawned on me that Timeline clips genuinely just feels like a worse version of AnimancerTransitionAsset. Really not a fan of the pattern with ScriptPlayable either with honestly how disjointed and fragile the binding logic feels.

    I know we have PlayableAssetTransition but that still acts on an Animator because AnimancerComponent does, I'm wondering if we can have the same smooth API experience for PlayableDirector too. Animancer itself can already kind of do that with a dummy animator and I can even assign bindings in a FAR MORE intuitive way with PlayableAssetTransition than with PlayableDirector. The resulting PlayableGraph is truly a hilarious sight to behold
    lolgraph.png
     
  6. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    I'm not really sure what you're asking for, but Animancer has no way of controlling a Playable Director, it uses the Playables API which requires an Animator.
     
  7. daenius

    daenius

    Joined:
    Sep 7, 2021
    Posts:
    11
    thanks for the reply! Yeah I was asking whether it's possible to control the PlayableDirector same way as what Animancer does with Animator. I didn't know the Playables API inherently requires an Animator.

    what's trippy is that it seems there's no need for a "PlayableDirectorMancer" after all. Animancer seems to happily play whatever Timeline i throw at it regardless of what the asset actually does with AnimationClips. I basically get to use (or maybe abuse lol) Animancer to play any PlayableAsset all the while being able to control what it does no different from any other AnimancerState
     
  8. DREBOTgamestudio

    DREBOTgamestudio

    Joined:
    Jan 30, 2018
    Posts:
    68
    When I use ClipTransition instead of AnimationClip I get an error warning.
    "Possible Bug Detected: The AnimancerEvent.Sequence being modified should not be modified because it was created by a Transition." and "Possible Bug Detected: An AnimancerEvent that does nothing was invoked. Most likely it was not configured correctly. Unused events should be removed to avoid wasting performance checking and invoking them."
    When I use attackAnimation is ok. When I use attackAnimationClip get an error warning.
    Code (CSharp):
    1.  
    2.    public void Awake()
    3.     {
    4.       _animancerComponent = transform.GetComponent<AnimancerComponent>();
    5.       Idle();
    6.     }
    7.  
    8.    private void Idle()
    9.     {
    10.       _animancerComponent.Play(_Animation);
    11.     }
    12.  
    13.    private void Attack()
    14.     {
    15.       var state = _animancerComponent.Play(_gameAssetsCatalogue.attackAnimationClip);
    16.       state.Events.OnEnd = Idle;
    17.     }
    18.  
    19.   public class GameAssetsCatalogue : ScriptableObject
    20.   {
    21.     [Header("Animations")]
    22.     [SerializeField] public ClipTransition attackAnimationClip;
    23.     [SerializeField] public ClipTransition idleAnimationClip;
    24.     public AnimationClip idleAnimation;
    25.     public AnimationClip attackAnimation;
    26.   }
    27.  
     
  9. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    When using transitions, you should set up their events on startup (in Awake instead of in Attack).

    The only way that code would cause the second warning is if you've added an event to one of the transitions in the Inspector and left its Callback empty, meaning it would do nothing as the warning says.
     
    DREBOTgamestudio likes this.
  10. iSinner

    iSinner

    Joined:
    Dec 5, 2013
    Posts:
    201
    Is there a way to get what events are defined in the transition, if the field that i have access to is of type ITransition?

    What i am doing, is in OnValidate(unity's callback), i create a state from ITransition and check its events, but i get a warning that an unused state was created every time GC runs, which is very inconvinient. THe way to solve this, would be to either not create the state, or destroy it by hand somehow(i tried calling destroy, but since Root is null, destroy does nothing to the state.

    This is the code:

    Code (CSharp):
    1. protected virtual void OnValidate()
    2.         {
    3.             if(Application.isPlaying) return;
    4.  
    5.             if(AnimationTransition.IsValid())
    6.             {
    7.                 //review: this generates warnings of unused nodes, this doesn't do any issues but warnings should be fixed. The state must be destroyed before exiting this scope, so that
    8.                 //at GC the state isn't collected and detected that it has no root to which it is attached(which generates the warning). Or the events from the transition must be obtained in a different way, that doesn't
    9.                 //involve state creation.
    10.                 var state = AnimationTransition.CreateStateAndApply();
    11.                 if(!state.Events.Contains(BasicAttackState.EventName.HitMoment))
    12.                 {
    13.                     Debug.LogError(
    14.                         $"Animation transition for {GetType().Name} does not contain {BasicAttackState.EventName.HitMoment} event. To fix the issue: add the event to the animation transition.",
    15.                         this);
    16.                 }
    17.             }
    18.         }
     
  11. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Cast it to ITransitionWithEvents (or just use that interface directly).
     
    iSinner likes this.
  12. iSinner

    iSinner

    Joined:
    Dec 5, 2013
    Posts:
    201
    I read in the thread that playables respects the animator cull mode. Let's say i set it to cull completely. I am not sure how performance is impacted when i have character off screen that run on the animancer.

    What is the impact of animancer when characters are off screen? lets say i have a 100 character in the game running at the same time, but only 10 of them are on screen. Should i be worried about the other 90 performance wise?

    Will there be any noticeable performance gain if i stop the playable graph for character off screen? or is this achieved by the animator cull mode?
     
    Last edited: Jun 1, 2023
  13. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    I haven't done any benchmarks to compare the cost of culling modes and most of those questions are heavily dependent on your specific use case anyway so there's no real way to answer them other than to test it yourself. In general, I would recommend not worrying about it unless you have a very large number of characters or notice an actual performance problem. If that happens, culling modes and pausing graphs are options you can look at.
     
  14. iSinner

    iSinner

    Joined:
    Dec 5, 2013
    Posts:
    201
    Thank you for the explanation.

    When it comes to the unity's animator, i know what to expect from it and how it works when the renderers are off camera.

    But I would like to know what the animancer itself is doing when characters are off screen. By my understanding, it keeps running, and it updates the time on the animancer states. What i am confused about, is how it interacts with the unity's animator.

    If the characters are off screen, and the animancer is running(is it running when they are off screen?), and the animator culling mode is cull completely, the playable graph is paused or not?
     
  15. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Animancer is updated by the Playables API so it should follow the same culling rules as Animator Controllers. I would assume that Cull Completely prevents updates entirely so it's effectively paused. You could check when it updates by registering an IUpdatable or just putting a log in AnimancerPlayable.PrepareFrame.
     
    iSinner likes this.
  16. m4a44

    m4a44

    Joined:
    Mar 13, 2013
    Posts:
    47
    Hey, is there any good way to transition to an animation that's already playing?

    I'm trying to get recoil while shooting working, and right now it either waits for the animation to play before playing again (doesn't "restart" the animation when calling play again), or I reset the time and it doesn't transition (jumping to the beginning of the animation).

    I know Animator had a "transition to self" setting for these types of scenarios...
     
  17. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    m4a44 likes this.
  18. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    a bit of a pretty unique situation here. We are probably using animancer in a way is not designed to for. We stack layers with complete override (no mask) to be able to automatically switch to the previous layer animation when we stop a layer animation. A sort of stacked animation system were a stop is equal to a pop, so we can fall back to the previous animation without being forced to actually play it.

    It all works great, expect that I was expecting the fade to work between layers too. This seems to not be true if the layer is set to override.

    Any thoughts or different idea to implement a similar solution?

    Btw from your examples it seems that fading out layer 1 should work while layer 0 is playing, but what happens in my case is that if I fade out layer 1, it will fade to the A/T pose instead than fading to the current animation playing on layer 0
     
    Last edited: Jun 9, 2023
  19. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Fading out a layer should not have any effect on other layers so if Layer 0 was active when you fade out Layer 1 it should end up giving the regular output of Layer 0. The only way it would go to the default pose is if no layers have any weight (and an animation with weight as well). Check the Inspector to see what's actually happening.
     
  20. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    thanks for the quick reply, very appreciated. Link to the video (will expire in 7 days)

    https://we.tl/t-ccYCHdYzhj

    Edit: I randomly checked "Apply Root Motion" in the Animator and now it works. I am going to discuss with the tech artists why is the case.
     
    Last edited: Jun 9, 2023
  21. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    You're fading out the state on Layer 1, but you should be fading out the layer itself like the examples do.

    I'm not sure how root motion could have any effect on that behaviour.
     
  22. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    it's not the root motion itself in fact. just switching the value to anything makes it work, it of course looks like some not intended behaviour. I will check what you are saying.

    edit: it would help if you could point out the example.

    at the moment I either do (in case of stopping the current layer):

    AnimancerEvent.CurrentState.Layer.StartFade(0)

    or (in case needs to start a new animation)_

    _animancer.Layers[(int)entityAnimLayer].TryPlay(_requestedAnimState.AnimName, 0.25f))

    edit 2: I may have sorted it out, thank you
     
    Last edited: Jun 9, 2023
  23. MikeChr

    MikeChr

    Joined:
    Feb 2, 2018
    Posts:
    45
    Hi. I have an object whose animation is divided into two independent phases signaled by the events: NoteOn and NoteOff. The NoteOn event triggers the instantiation of the object and the start of the NoteOn animation. Sometime after NoteOn is the NoteOff event which signals the transition from the NoteOn to the NoteOff animation. The end of the NoteOff animation signals the destruction of the object. I have all this working with two ClipTransitionSequences and that’s great.
    Now for the question. I would like to add a third animation that starts with the NoteOn event (NoteOn animation) and runs to the end of the NoteOff animation. I think this means I want animations (clips) to run in parallel or in a nested configuration(?). I see Layers as an approach but this is a simple object (not humanoid) and layers requires masks? I would like to keep this as simple as possible. Thanks for your time.
     
    Last edited: Jun 12, 2023
  24. daenius

    daenius

    Joined:
    Sep 7, 2021
    Posts:
    11
    Hope you don't mind me jumping in here because I'm curious about the setup. Aren't you instantiating a different object or a clone of the source object? Unless by events you mean just C# or UnityEvents as opposed to AnimancerEvents.
     
  25. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Layers don't require masks or humanoid. Without those, the highest layer will just override the others so if all you want is to let multiple animations play at the same time (while seeing the results of only one) then layers should be exactly what you want.
     
  26. MikeChr

    MikeChr

    Joined:
    Feb 2, 2018
    Posts:
    45
    Hi. I am instantiating a prefab. The events originate as MIDI events from a DAW and are translated to Visual Scripting Custom Events that drive an animation or Unity Timeline events using Keijiro Takahashi's MIDI Timeline Track package to playback recorded MIDI tracks.
     
  27. MikeChr

    MikeChr

    Joined:
    Feb 2, 2018
    Posts:
    45
    I should have mentioned that the parameters being driven by the third animation are not members of the parameters driven by the NoteOn/Off animations. For example, I want to drive transparency of the object's material to make it fade in and out during the object's lifetime. Does this make any difference?
     
  28. daenius

    daenius

    Joined:
    Sep 7, 2021
    Posts:
    11
    aha! I was playing with that repo recently! you have a ton of options for doing what you want in that case, especially with Animancer. From my experience Animancer doesn't care what you throw at it so having the third animation drive the transparency of a material is not a problem at all. You even have multiple different ways to do it which is absolutely nuts, for example, assuming you want all these to happen at the same time, do Additive Layer with the Layer only containing the animation for the transparency, or you can do AnimatedProperty if you don't want Layers, or you can do AnimationJob + AnimancerJob wrapper (wrapper optional but it's really nice).

    I did something similar going with the AnimancerJob option to procedurally change blendshapes, material parameters, and play audio based on the animation being played.
     
    MikeChr likes this.
  29. MikeChr

    MikeChr

    Joined:
    Feb 2, 2018
    Posts:
    45
    Hello Daenius. I have not noticed AnimatedProperty until you mentioned it. Is it possible to share some of this code? I've looked at AnimancerJobs in the docs, but am having difficulty understanding. Will spend some more time today.
     
  30. BlankMauser

    BlankMauser

    Joined:
    Dec 10, 2013
    Posts:
    138
    Hey, hopefully a simple question that I'm not understanding how to do. I'm updating Animancer using a simulation (A networked tick) and I seem to be getting inconsistent behavior:


    This is currently how im setting Animancer:

    Code (CSharp):
    1.         var anim = _Animancer.Play(state.Animation);
    2.         anim.NormalizedTime = (float)ent->FSM.AnimationFrame / (float)stateData.scaledLength;
    3.         _Animancer.Evaluate();
    This is running in the update of Unity but i'm quickly finding out this is not enough to get the results I want. It seems like the results are not always consistent. The animation is playing at its own speed regardless of what I set its normalized time to every frame? And I sometimes need to set the frame very absolute to match the simulation. Example, when a character takes a hit I need them to pop into a specific frame instantly.

    Appreciate any help.
     
  31. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    If you just want to set the time and don't need to do anything with the model's resulting pose immediately, you don't need to call Evaluate. The time you set will take effect during the next animation update (unless you pause the graph).

    If it's not going to the time value you set, then most likely either your code isn't actually running the bit you're expecting or you're looking at the wrong object. The only way you could set the time without it taking effect would be if you pause the graph and also don't call Evaluate.
     
  32. daenius

    daenius

    Joined:
    Sep 7, 2021
    Posts:
    11
    Kybernetik himself has excellent explanation here for AnimatedProperty https://kybernetik.com.au/animancer/docs/manual/ik/#animated-properties

    You add a curve for your property (name it whatever you want) using one of the 2 ways mentioned in that document page, assign it to a property reference, then read from it whenever you need it and use the value you read to set the value of whatever you want. In your case that'd be something like the transparency of a material as you've previously mentioned.

    I'm using AnimancerJob myself but it wouldn't be too different to use an
    AnimatedFloat
    , so it'd look something like this (sorry for any mistakes I just haphazardly replaced my AnimancerJob reference with the AnimatedFloat)

    Code (CSharp):
    1.  
    2. private void Update()
    3. {
    4.     for (var i = myAnimatedFloat.GetValues.Length - 1; i >= 0; i--)
    5.     {
    6.         _targetMesh.SetBlendShapeWeight(i, myAnimatedFloat[i]);
    7.     }
    8. }
    9.  
    In case you're wondering why not just directly use an AnimationClip that binds a SkinnedMeshRenderer, it is because I don't want to make a new clip for every mesh.
     
    MikeChr likes this.
  33. laja

    laja

    Joined:
    Sep 29, 2022
    Posts:
    17
    Hi! Is Animancer (Lite) supposed to work with the 2022 LTS? During Package Manager / Import I am getting the notification to recompile things, and still I get a TypeLoadException problem. Maybe the issue is that I have moved the asset from the Plugins folder to 3rdParty/Animancer ?

    TypeLoadException: Could not load list of method overrides due to Could not resolve type with token 01000056 from typeref (expected class 'System.Object' in assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') assembly:System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Object member:(null)
    Animancer.AnimancerTransition`1[TState]..ctor () (at Assets/3rdParty/Animancer/Utilities/Transitions/AnimancerTransition.cs:30)
    Animancer.ControllerTransition`1[TState]..ctor () (at <16cb9cdf3b584a0f8f0b0bbbe3eb38fa>:0)
    Animancer.Float1ControllerTransition..ctor () (at Assets/3rdParty/Animancer/Utilities/Transitions/Float1ControllerTransitionAsset.cs:45)
     
    Last edited: Jun 19, 2023
  34. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Delete Animancer, Re-download it in the Package Manager, then Import it again.

    Animancer Lite needs to be compiled for specific versions of Unity due to API changes and the Package Manager automatically downloads the correct version the first time, but if you change Unity versions it still uses the existing Animancer package on your computer instead of forcing you to download the one that will actually work.
     
    laja likes this.
  35. laja

    laja

    Joined:
    Sep 29, 2022
    Posts:
    17
    Thanks a lot, this fixed the problem :) Indeed I was playing with the 2021 LTS and now I just tried the 2022 LTS.
     
  36. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    Hi, I want to report again the previous problem I had. I previously fixed stopping the layer instead than the state, but then I realised that the correct procedure is stopping the state, so I am not sure if I am doing something wrong or it's an animancer bug.

    To recap, when I stop an animation I execute this code:

    Code (CSharp):
    1.    if (_animancer.States.TryGet(animName, out var animationState) && animationState.IsActive) //isactive = playing or fading in
    2.                 animationState.StartFade(0, EntityView.FastFadeTime);
    We use the Base layer as idle animation and the layer 1 (override) as move animation like shown here:

    upload_2023-6-22_9-53-47.png

    when I execute the code above to stop move_loop, the character swap to t-pose for 1 or 2 frames, but only at the end of the fading:

    frame before the issue while fading out:
    upload_2023-6-22_9-54-55.png
    frame showing the issue:
    upload_2023-6-22_9-55-7.png
    frame after return to idle as expected:
    upload_2023-6-22_9-55-26.png

    this DOES NOT happen if I fade the whole layer instead than the state, but I think it's more correct to fade the state and not the whole layer. My previous fix was indeed just to do this

    Code (CSharp):
    1.   if (_animancer.States.TryGet(animName, out var animationState))
    2.                 animationState.Layer.StartFade(0, EntityView.FastFadeTime);
    at the moment I am back to fading the layers, but I still think it's not the right way to do it.
     
    Last edited: Jun 22, 2023
  37. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Fading the layer is correct because layers aren't mixed in the same way as states.

    States are mixed by basically multiplying each of their values by their weight then adding all those together. It's basically a straightforward weighted average and if the weights don't all add up to 1 you usually get a useless result. That's especially true for Humanoid rigs where if the total is less than 1 it will effectively blend the remainder towards the default Humanoid hunched over pose.

    Layers can be either set to Override (default) or Additive. Additive isn't relevant here, but override will start with the highest layer and work downwards adding each layer weight until the total weight reaches 1. So when your Layer 1 has Weight 1, it will be the only thing affecting the output, meaning it's effectively the same as if you only had the base layer with a 0.5 Weight state on it, which means it's blending halfway between that state and the default Humanoid pose.

    All that is handled by the Playables API so the only change I could actually make would be to use a regular mixer instead of the layer mixer which would mean no additive animations, no masking, and you need to always make all your layers add up to 1 weight (though I suppose Animancer could automatically normalize whatever values you set).
     
    sebas77 likes this.
  38. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,653
    Thank you for the reply, If I get what you are saying correctly, I think I came to the same conclusion: Override actually overrides so when weight is < 1 is not mixing with the layer below, it's mixing with T-Pose.

    I was personally expecting it would have mixed with the layer below instead.
    This because I may need to fade out just one state of the layer 1 instead of all of them...in this case I have to do several checks to decide if I want to fade a single state or the whole layer.

    Edit: I am actually confused now as I am not sure if it makes sense to stop a state. The option exists, so I would assume it does, but at the same time I wonder if a state should always play (so only switching between states is valid). Can current state be invalid or a current state always exists but may be stopped?
     
    Last edited: Jun 22, 2023
  39. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    833
    Hi!

    I'm trying to emulate a stop-motion effect using Animancer.

    The rough strategy is the one outlined in this repo: https://github.com/EricFreeman/FakeStopMotion

    The only difference is that I replaced Animator.Speed by AnimancerComponent.Playable.Speed.

    It works except when transitioning between two animations. During the transition, the motion is completely smooth. As soon as the transition is over, the stop-motion effect starts working again.

    Is there any way I could make it work for transitions as well?

    Thanks in advance!
     
  40. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    @sebas77 In most cases, everything that has animations will always want to be playing something, but if you want to manipulate states individually the system does support that. The CurrentState is just the most recent state started by a Play method so if you Play State A then set its Weight to 0 and State B Weight to 1, the CurrentState would still be a reference to State A.

    @Ludiq I can't think of any reason why that technique would stop working during a transition and I just did a quick test which worked as expected. Are you able to replicate the issue in a simple scene with nothing else in it? If so, please send me a minimal reproduction project so I can take a look at it.
     
  41. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    833
    Thanks for the very fast reply!

    With that insight, I looked into my specific case further and figured out that CustomFade.Apply was the function causing the effect to stop working.

    Is there any way to make custom fades honor the playable speed parameter?
     
  42. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Yep, just open the CustomFade script, find the line with
    _Layer.Speed
    and put in
    * _Layer.Root.Speed
    next to it. I've made that change so it will be in future versions.

    I would expect to see better performance from actually pausing the graph and telling it to evaluate when you want as demonstrated in the Update Rate Example instead of setting the Speed to 0 which still lets it recalculate and re-apply the same values every frame. A combination of both where you pause but then unpause and set the Speed instead of calling Evaluate as explained in this thread could potentially have better performance, but my quick testing wasn't able to confirm that so I need to go back and test it again sometime.
     
    hopeful likes this.
  43. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    833
    The fix worked, thanks again for the very quick support!

    I tried pausing the graph first but it has some other unwanted side effects (our animation stack is pretty complex). I might revisit it later for performance reasons, but right now speed at 0 works.
     
  44. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    96
    I didn't use Animancer for now, but i want to ask one question before i start use it: I have to objects, that are playing two different animations with different animatorcontrollers (i now use mecanim), speed, time and so on. But at some point in time i need to blend animation of one object to other's and after that they should play same animation with absolutly same state and speed. Is it possible to implement with Animancer and how?
     
  45. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    You can easily get and set the speed/time/etc. of any animation so it's definitely possible.

    If the copy blend will be longer than any other fade you had active, you could simply get the originalAnimancer.States.Current.Clip and tell the clone to fade to it using FadeMode.FromStart (then set its Time to match).

    Otherwise, you'd need to iterate through each animation of the original and essentially do the same thing for any states with a TargetWeight above 0.
     
  46. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,082
    @Kybernetik
    I would like to know if there is a quick way to make sure the animations are synced across the network when using Animancer with Photon Fusion.
     
  47. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    • The Disadvantages section on the State Machines overview explains my very limited understanding of networking and the challenges caused by the Animancer allowing you to play animations from anywhere.
    • The Photon Fusion Technical Samples include one that uses Animancer.
    • This Thread has a few other people with experience networking Animancer.
     
  48. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Is there a way to make sure that a looping animation that gets stopped is played until the end of its current loop? I would like to play an animation when moving an object from A to B but don't want it to stop apruptly when it has reached its destination.
     
  49. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,605
    Get the state you want to end and call
    state.Events.Add(AnimancerEvent.AlmostOne, MethodToPlayTheNextAnimation);
    to add an event at the end of the loop to play the next animation you want.
     
    c-Row likes this.
  50. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    2,082
    Well, I see it a bit complex. Let me see if I can find a quick solution. Thanks for sharing!