Search Unity

Animancer - Less Animator Controller, More Animator Control

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

  1. GamerXP

    GamerXP

    Joined:
    Mar 22, 2014
    Posts:
    78
    I'm using Lite for now and planning to buy it if it fits my needs. Well, I can go back to 2019 since I'm using 2020.2 now just to check its stability (2019.4 crashes all the time and I'm tired of it).
    But having
    [CustomPropertyDrawer(typeof (MixerState.Transition<,>), true)]
    on abstract class doesn't even make any sense since all derived drawers got their own CustomPropertyDrawerAttribute
    Actually, I get the feeling CustomPropertyDrawer for generic class didn't even work before, but I'm not sure.
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Yeah, it must have been left over from when the class wasn't abstract and the base mixer transition wasn't generic. But it never came up because all transition types have a more specific drawer that should have prevented it from ever being used.

    I've attached the fix. Let me know how it goes.

    Edit: removed the package since a newer version is now available.
     
    Last edited: Oct 21, 2020
  3. GamerXP

    GamerXP

    Joined:
    Mar 22, 2014
    Posts:
    78
    Yes, it works fine now in 2020.2.0
     
  4. iv2b

    iv2b

    Joined:
    Aug 2, 2018
    Posts:
    25
    Hey there, i'm interested in this asset, i've had to tackle with mecanim a few times.
    The sale is going to end soon and i'll have an exam in 2 days, so i can't quite test it out, i'll instead try asking you. :)

    What i'm attempting to do is creating an animation system akin to the one used by Overgrowth, explained in [this video].
    Essentially the approach involves very few keyframes and smart use of interpolation to animate between them.

    So i'll either have animations with 1 keyframe (actually 2 as that's the minimum) and blending between them over time using a curve, or i'll have the animation with linear interpolation and making it slower/faster by sampling a curve.
    How easily can that be achieved with animancer?
    With mecanim i've had to manually switch between individual animation files, which scales very poorly.

    Additional question - does animancer support extrapolation?
    Let's say for example that i have two keyframes, one has x=5, the other has x=10.
    Ideally i'd want to extrapolate that and reach x=20 for example.
    Manually this would be done by looking at the previous keyframe, the next keyframe, calculate the difference between the two and multiply it by how much i intend to extrapolate.
    This is used in Overgrowth for the crouching animation, see the video above at 7:57.
    How easily can this effect be achieved with animancer?

    Thank you in advance!
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    You have direct control over the Speed, Time, and Weight of all animations so it should be easy to control them however you want.

    Extrapolation is probably the sort of thing you would do with Animation Jobs, but I haven't used them much so I don't know how easy it would be. They don't give you explicit access to keyframes, only the animation data at the current time, so you might need to connect two playables of your clip set to the times you want to extrapolate and have the job calculate where everything should be based on its time.

    Have you considered whether or not you really need dynamic pose control at runtime? Obviously the primary aim is to be able to author single poses, throw them at the system, and be done with it. But what if rather than implementing a runtime system to manage poses and interpolation, you instead implement an Editor Window that takes a couple of single pose clips and generates a regular Animation Clip using them as its keyframes which you can then play normally? That way if you want something like an extra keyframe based on the extrapolated values from earlier you could easily do so. You also wouldn't need to worry about efficiency and it would likely be way easier to implement than figuring out the Animation Jobs system.
     
  6. iv2b

    iv2b

    Joined:
    Aug 2, 2018
    Posts:
    25
    Hey thank you for replying!

    Thus far i've only found 2 ways to reasonably get the result i want:

    1. I create each pose using umotion, so i can see exactly how they'd look ingame.
    Then i interpolate between them with a custom script, i can do extrapolation here by myself.
    Next, i record the animation using unity's recorder package.
    I now have to convert the animation to humanoid using a converter (if making humanoid animations) and make sure it loops (if it has to loop).

    It works, but it's tedious.

    2. Use Blender's NLA editor.
    It's a bit clunky as it's not designed for my use case, but it otherwise works. I can make 1 keyframe animations and blend between them with a single curve, including extrapolation.
    Main issue with this approach is that i can't quite see how the animation looks ingame, which is not the best when dealing with first person animations for example.

    Making the animation right to begin with is something i always failed at since most animation tools let you tweak all curves individually. So my humanoid model may have 100+ curves every keyframe, rather than 1, making it impossible to work with.

    The ideal solution is to put all keyframes in the same animation, then adjusting speed and extrapolation/dampening with 2 curves.
    For example i can have a 4 keyframe animation, each keyframe is 10 frames apart.
    Then i can adjust how quickly the animation plays, so maybe between frames 2 and 3 it's slower and between 3 and 4 it's faster.
    Then adjusting "weight" (not quite the correct term, dampen/extrapolation) with a 2nd curve. Script-wise this is done by taking the difference in rotation/position between now and the previous keyframe, multiplying it by the sampled value and adding it to the keyframe value. (eg: i'm at the exact middle between x=5 and x=10, with sampled value being 1.5. so i'm at 7.5, 2.5 from the previous keyframe, 2.5*1.5=3.75, position should be 8.75)

    I can do the above with mecanim technically by using a custom script that edits at which point in the animation i am and editing the bone position/rotation or whatever i'm animating, but it falls apart when mixing animations and when working with different avatar layers (it can work, but i'd be calculating everything myself, at which point why am i using mecanim?). Plus i'd have no convenient way to store those 2 curves.

    If animancer can make this process easier then it'd be worth trying, i've honestly been looking for a practical solution (to my admittedly niche scenario) for 2 years now.
    Once again i'd love to sink my teeth in the lite version and try it out, but the sale runs out on the 30th and i have exams to crunch through. x)
     
  7. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    I recommend at least downloading Animancer Lite and having a look at the first few examples to get a proper idea of how it works. It sounds like it gives you the control you're looking for, but it's hard to say for certain without judging it in person.
     
  8. iv2b

    iv2b

    Joined:
    Aug 2, 2018
    Posts:
    25
    That's fair i'll do that, thank you for your replies, i appreciate it! :)
     
  9. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi @Kybernetik , what is the advantage of using the new HybridAnimancerComponent instead of using regular animancer to play controllerstate and animancerstate?
    They seem to play nicely together, is there any limitation that I'm not aware of?
     
  10. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    It's just a wrapper around a ControllerState with a bunch of convenience methods for controlling it. You can open the script to see what it does. And it's certainly not new, I added it sometime around v3.0 which was about a year and a half ago.
     
  11. Havie

    Havie

    Joined:
    Oct 12, 2019
    Posts:
    89
    Hi guys,

    Trying to figure out the best way to make a hack n slash game like Dynasty Warriors. It seems Animancer might be the best option.

    However, I want to make scalable move sets that can be easily swapped out. So I made a scriptable object base class
    and gave it two arrays for my clips:

    Code (CSharp):
    1.  
    2. public ClipState.Transition[] _normal;
    3. public ClipState.Transition[] _strong;
    However, i want to set up callbacks on these clips via the inspector (one of the best parts of animancer),
    upload_2020-10-2_0-42-15.png
    Reason being I want to tell the character controller these clips are eventually attached to that an animation has finished or something else important has occurred.
    Since a scriptable object saves state I cant think of a way to cache this operation without it applying across the board to everyone using the same scriptableObject and calling the same character controller.

    I guess I could write the callback function to always do a :
    Code (CSharp):
    1. this.GetComponent<customClass>().Callback()
    but that doesnt seem efficient?

    This is my first game like this and I could really use some advice. Thanks
     
  12. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    In the Weapons example I made the Weapon class as a MonoBehaviour since the animations and other details are going to be associated with a weapon model anyway. Otherwise, the Shared Event Sequences section has some solutions to that problem.

    Also if you haven't already, take a look at the Golf Events example. You might prefer the hybrid approach of using the Inspector to set event times and names but leaving the callbacks blank so that you can set them in code.
     
  13. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    681
    Has anyone had success using this with AssetBundles fetched from the cloud? I'm working on a Do Everything At Runtime platform (https://servicemedia.net) and I can't seem to find a config that works, no matter what I try. It works fine with local files, but I can't get an animation to play on an AssetBundle, although the model is the same, the setup looks identical, and there are no errors or warnings, and the editor window says it's playing. Any help appreciated!

    On a positive note, I can confirm that Animancer also works with GLTF models! Here's a gist: https://gist.github.com/polytropoi/91c1625826783a3ad283bccf6ffccf30 that uses https://github.com/Siccity/GLTFUtility
     
  14. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    I don't have any experience with Asset Bundles but I don't wee any reason why an AnimationClip loaded from there should be different from any other.

    Maybe try a simple animation that just rotates a cube in case the problem has something to do with bones or avatars or something like that.
     
  15. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi @Kybernetik,
    I don't know if it's a bug or what. I have a gun fire animation with an animation event on the animation clip itself on the first few frames.
    I play the clip with animancer and it often play in sequence few frames from each other when firing rapidly but the events gets called only once until I play some other animation clip and play the fire animation again.
    What do I need to do to get events to works properly without having to redo all the events in animancer internal system?
     
  16. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    As long as your event isn't at time 0 (which would cause this bug) there shouldn't be anything special you need to do.

    If you can make a minimal reproduction project and send it to me, I'll take a look at it for you.
     
  17. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    I checked and it was indeed at frame 0, I thought I had put it later.
    Moving the event worked, thanks.
    I wonder when they are going to fix the bug, the release note are always full of minor bugs while the important ones get delayed for long.
     
  18. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    681
    Is that Scottish? :) I got it to work with remote AssetBundles by just adding the Animancer component the the prefab, along with a simple script with a populated array of animationClips, before building the AssetBundle (it's OK to add code to assetbundles as long the same classes are in the parent/target build). Instead of trying to wire it up on the fly, so to speak, by sniffing the models and adding/ configuring everything, I just get the components attached to the loaded models and it works perfectly. I'm super impressed and grateful for the work you've done on this - practical runtime animation-fu really opens the way for me. Unity should give you a big pile of money.
     
    Kybernetik likes this.
  19. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    518
    Hi there,
    I'm quite interested in your asset, we've a quite complex system working with the default mecanim FSM, we use it for :
    - Application states and transition (One FSM for general purpose, handling scene loading, and one fsm per scene group for handling the logic)
    - Characters animations (Locomotion & attacks)
    - UI & props animations

    It's been some years now and we've been patching mecanim wherever it was not working as expected. We're considering moving to something more flexible and customizable, hence we looked into playables and discovered your asset.
    Some questions :

    - Is there a visual FSM like for mecanim based on playables ?

    Is there a quick guide to easily transition and port from Mecanim to Animancer ?
    What we'd like to be able to do is :
    - Better character animation synchronisation
    - Ability to use timelines for certain animations instead of pure Animation asset (For instance combining multiple animations, or making a cutscene)
    - Overall just better control as mecanim does a lot of "hidden work"

    Cheers.
     
  20. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Mecanim is technically based on Playables, but no, the FSM system included with Animancer doesn't have a special window for configuring it visually. I find that implementing my states as MonoBehaviours or ScriptableObjects and just using the Inspector to set up any necessary references is good because it keeps all the logic in scripts where it's supposed to be instead of arbitrarily separating some parts into a visual system like Animator Controller transitions.

    The 3D Game Kit example goes through the process of converting an Animator Controller based character to use Animancer, but the systems are nothing alike so there can't really be a quick and easy porting guide.

    Animancer is great for that because it doesn't try to be a FSM. If you tell an Animator Controller to do something you just have to hope that it has the state you want and the right transition and that it's actually in the right state at the moment, etc. but with Animancer you tell it to do something and it just does it. All the decision making is done by your code.

    The Platformer example uses a Timeline to string together a couple of animations into an intro sequence. I'm currently in the middle of releasing Animancer v5.3 which makes a few improvements to the Timeline support.
     
    Whatever560 likes this.
  21. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Hey everyone, Animancer v5.3 is now available on itch.io (and should be up on the Asset Store in the next few days). Anyone using nested mixers or Timeline assets should definitely update because it has some notable fixes and improvements for them.
     
  22. sparklingwiz

    sparklingwiz

    Joined:
    Jun 3, 2020
    Posts:
    1
    Hi @Kybernetik, I have bought the pro version and have been loving it so far, so much control compared to Mecanim.
    However, I am having some problems with states transitioning into themselves, and playing the same animation.

    With my setup right now,
    When the player dodges, it will transition to the idle(root) state when the animation finishes playing.
    If the dodge animation is beyond 0.8f normalized time, the player can transition early to another state.

    However, if I dodge @0.9f => dodge, the dodge animation continues at 0.9f instead of starting a new dodge animation.
    If I spam the dodge key, it will repeatedly enter/exit the dodge state and play the dodge animation starting at 0.9f, with the CanExitState evaluating true.

    Is there a way to do something make Animancer play a clip from start?
    Is this the correct way to use your framework, to implement something like an early exit time?

    Code (CSharp):
    1.  
    2. public class PlayerDodgeState : PlayerState
    3. {
    4.     [SerializeField] AnimationClip dodgeClip = null;
    5.     [SerializeField] float earlyExitTime = 0.8f;
    6.     [SerializeField] AnimationCurve animationCurve = null;
    7.     AnimancerState currentState = null;
    8.     Vector3 movementVector = Vector3.zero;
    9.  
    10.     private void OnEnable()
    11.     {
    12.         currentState = PlayerBrain.Animancer.Play(dodgeClip);
    13.         currentState.Events.OnEnd = () => PlayerBrain.PlayerStateMachine.ForceSetState(PlayerBrain.PlayerRootState);
    14.         movementVector = PlayerBrain.PlayerController.transform.forward;
    15.     }
    16.     private void Update()
    17.     {
    18.         float delta = animationCurve.Evaluate(currentState.NormalizedTime);
    19.         PlayerBrain.PlayerController.Move(delta * movementVector * Time.deltaTime);
    20.     }
    21.     public override bool CanExitState(PlayerState nextState)
    22.     {
    23.         if (currentState.NormalizedTime > earlyExitTime)
    24.             return true;
    25.         else
    26.             return false;
    27.     }
    28. }
     
    Last edited: Oct 8, 2020
  23. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    The Playing and Fading example should explain what you're looking for.

    Also, you don't need to store the currentState. You can access the most recently played state using PlayerBrain.Animancer.States.Current.
     
  24. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi there,
    I realize this may not be related to Animancer but I was hoping you might have some insight into this.

    I want to incorporate ragdoll with animations. Some basic online research to this is simply to turn off physics, if animating and turn on for ragdoll. However this does not work yet.

    "Physics" in this case, is Collider.enabled, Rigidbody.useGravity, Rigidbody.isKinematic and Animation.RootMotion. However, to date, animations and ragdooll seem very incompatible.

    If you have any insight into this, please share.


    Thank you
     
  25. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Something like the Damping example might be of interest to you, but other than that I have never used anything like a ragdoll before.
     
  26. Milionario

    Milionario

    Joined:
    Feb 21, 2014
    Posts:
    138
    Hi how to apply root motion on layers?

    For example I have a walking animation running on a layer that uses a lower body avatar mask, and another animation on the upper layer, however the character doesn't walk forward

    upload_2020-10-20_11-25-51.png

    upload_2020-10-20_11-26-36.png

    upload_2020-10-20_11-26-52.png

    By the way the walking animation works on the base layer

    I also tried making the base layer weight 0 but no effect

    upload_2020-10-20_11-39-3.png

    Tried making the lowerbody layer additive and got something

    The character is walking backwards but also blending with the default empty animation which makes it get stuck in the ground because of his center.

    Don't mind the Base layer running also, that was my mistake as i called animancer.Play() before creating the other layers, but removing that call had no effect also


    EDIT:
    Solved by doing this:

    https://imgur.com/aWslgiv
     

    Attached Files:

    Last edited: Oct 20, 2020
  27. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Yeah, that's pretty much how I would do it. A base layer with no mask for the lower body so that it can control the upper body if you aren't doing anything with the upper body layer. Then a masked upper body layer which you can fade out when it's not needed.

    Also, you don't need to set IsAdditive to false because that's its default value.
     
  28. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    Is there an edge case where if I play an animation, the end event doesn't get triggered? I need a guaranteed end event to change the state of the state machine.

    Edit: Hmm, it seems it happens if I call StartFade and then try to play that animation within the fade duration. Not sure what the best way to handle that is. Can I cancel the fade? Basically, I'm triggering my attack animation rapidly.
     
    Last edited: Oct 22, 2020
  29. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
  30. craigjwhitmore

    craigjwhitmore

    Joined:
    Apr 15, 2018
    Posts:
    135
    For a one time animation, I check the End Time event in the inspector, make sure this is checked.
    Untitled.png
     
  31. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    Code (CSharp):
    1.                 var state = CharacterAnimation.Animancer.Layers[1].Play(attackAnimation, 0, FadeMode.FromStart);
    2.                 state.Events.OnEnd = () =>
    3.                 {
    4.                     // this works
    5.                     // CharacterAnimation.Animancer.Layers[1].Stop();
    6.                     // But this causes the next attack animation to not trigger the end event
    7.                     CharacterAnimation.Animancer.Layers[1].StartFade(0);
    8.                    
    9.                     CharacterAnimation.AttackStateMachine.TrySetState(neutralState);
    10.                 };
     
  32. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    @craigjwhitmore Leaving the End Event time unticked just means that it will determine what time to use based on the speed. Positive speed ends at 1 and negative speed ends at 0.

    @kheldorin Stop and StartFade will both clear all events from states on that layer so there shouldn't be a difference in that part of the behaviour. Try stepping through your code with a debugger (or just logging stuff) to figure out what is actually happening.
     
  33. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    @kheldorin Stop and StartFade will both clear all events from states on that layer so there shouldn't be a difference in that part of the behaviour. Try stepping through your code with a debugger (or just logging stuff) to figure out what is actually happening.[/QUOTE]

    Isn't the difference the delay of the Stop and the clearing of events?

    Attack1->StopForAttack1->Attack2->StopForAttack2
    vs
    Attack1->StartFadeForAttack1->Attack2->StopForAttack1

    The delayed StopForAttack1 prevents Attack2 from triggering the end.
     
  34. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    StopForAttack1 should not be getting called after Attack2.

    StartFade clears events immediately then if the fade ends at Weight = 0 it calls Stop which will clear the events again (i.e. StartFade(0) will call Stop when the fade ends but StartFade(1) won't).

    But calling Play calls StartFade(1) so when you Play Attack2 the previous StartFadeForAttack1 should be completely cancelled so StopForAttack1 never happens because the layer never fades to 0.
     
  35. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    When I log it, I get Attack1->Fade1->Attack2. There's no Fade2. When I look at the inspector, the weight for the attack is 0. I only visually see 1 attack. I'm just gonna stick with Stop for now.
     
  36. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    I didn't realise that your fade duration was 0. In that case you shouldn't be using StartFade anyway so Stop is correct there. You also shouldn't be using FadeMode since you can just set the state.Time. Your code should look like this:
    Code (CSharp):
    1. var state = CharacterAnimation.Animancer.Layers[1].Play(attackAnimation);
    2. state.Time = 0;
    3. state.Events.OnEnd = () =>
    4. {
    5.     CharacterAnimation.Animancer.Layers[1].Stop();
    6.     CharacterAnimation.AttackStateMachine.TrySetState(neutralState);
    7. };
    The Playing and Fading example explains what FadeModes are for.
     
  37. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    No, the fade duration is the default 0.25s but the weight is 0. Is it possible for the end of Attack1 to fade with the start of Attack2? But both Attack1 and Attack2 refer to the same animation?
     
  38. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Your Play call has 0 fade duration: ...Play(attackAnimation, 0, FadeMode.FromStart);
     
  39. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    I was referring the the fade duration for the StopFade. Even if the StartFade duration is non-zero, I can't use StopFade. Only Stop works and triggers the end event.

    That's the point I'm trying to make ie When StopFading and then StartFade starts, the StartFade did not cancel the StopFade. If it was cancelled, the weight wouldn't be 0 in the inspector and the end event would have fired for the second attack.
     
  40. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    It's because of the weird way you're mixing fade durations with no fade duration. Calling Layer.StartFade(0) then Layer.Play would normally cancel the fade on that layer, except that you are giving Play 0 fade duration so it's not treating it as a fade and not expecting to need to cancel one. If that's what you actually want to do, then you can just call Layer.StartFade(1) along with Play to get it to stop fading out.
     
  41. mercuriousreign

    mercuriousreign

    Joined:
    Nov 30, 2017
    Posts:
    5
    Can someone give me advice/example on how to use Animancer Lite to create a combo fighting system? I have been going over the manual with FSM and also Creature brain but it doesn't seem to get inside my head. I tried using startcorutine(animationclip) but I feel like it doesn't finish/ immediately goes back to idle state. I have a hard time trying to trigger the animation. I think I also tried using Normalized time.

    Does my idle state code where if I use if(!Input.Anykey && jump==0) override the animation?

    edit: I actually also made a separate AttackState script based on manual where key from main script would enable the attactstate script and would play the animation inside update. which I think works....but doesn't really transition well when I change the clip from the attackstate script...guess I should send the clip to attackstate from the main script?
     
  42. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    The Weapons example and the rest of the State Machines examples show how I would approach that sort of thing. In particular, it sounds like you're having trouble with Interrupt Management. If there's anything in the examples that you don't understand, please let me know so that I can continue to improve them.
     
  43. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    197
    Is it possible for you to make a quick video on how to use this plugin? I am a more visual learner. Please make a video on how to use it. These days everyone provide a video explanation

    If I provide you with some sprites for some melee combat will you be able to show how to use this for a 2D controller? I am also not clear how I make the animation using sprites/spritesheet using this plugin. In unity animator, I just drag the sprites into the scene. But what to do for Animancer?

    I am making a 2D beat them up game with a lot of sprite animations.
     
    Last edited: Oct 30, 2020
    stain2319 likes this.
  44. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    A while ago I posted a list of reasons why I find pure video tutorials to be an extremely inefficient teaching method. If I made a video for the Quick Play example, it would either have to waste most people's time explaining things they already know like how to check when the mouse is clicked or it would skip over information which beginners need. But as text, everyone can read at their own pace, skip over any sections they already understand, use the links to the C# in Unity section and other resources for topics they don't understand, and so on. If someone tells me they are having trouble following a particular section I can easily improve it. If something needs images or a gif showing a process I only described in text, just let me know.

    The Weapons example shows an implementation of melee combat animations (there isn't really any difference between 3D and sprite animations) and the Character Controller example shows an implementation of 2D movement. There's also the Platformer example if that's more what you're looking for.

    But if you have a specific topic in mind which isn't really covered by any existing examples then I will certainly consider making a new one. Any sprites you give me would need to be reasonable quality and also need to use the CC0 License for the Asset Store to allow me to include them as 3rd party assets.

    You make AnimationClips for Animancer exactly the same way as you would make them for an Animator Controller. Animancer is a different way to play them, but the creation is the same. The Directional Sprites page has some links to Unity tutorials about creating Sprite animations, but dragging them into the scene works fine.

    That said, I want to add some utilities to make the creation of Sprite animations easier but I haven't actually used them in any of my games and I'm not very familiar with that part of the pipeline. So the question is: how do you want to create animations from your Sprites? For example, I could make an Editor Window where you select a bunch of sprites and it lets you bulk rename them while keeping the numbers (or keeping the order but starting from 0) and generate an Animation Clip with that name. Does that sound useful?
     
  45. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    197
    A gif explanantion of how you creating the 2D animations and linking it to animancer would be cool too.

    Here is a sprite sheet example.

    https://www.spriters-resource.com/genesis_32x_scd/sor2/sheet/10976/


    For 2D animations, we usually use skeletal animation/ single frames / sprite sheet.

    For my game, I am using single sprite( png image) or a sprite sheet.
     
  46. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    197
    that sounds super useful.

    For example idle 0-10 I drag to something and it creates animation perhaps? Sorry, I am new to your plugin. Its been very confusing to me. I am used to unity animator and having a controller.
     
  47. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    197
    I don't see an animator controller component to it with animations for your 2D sprites
     
  48. craigjwhitmore

    craigjwhitmore

    Joined:
    Apr 15, 2018
    Posts:
    135
    Don't you add sprites to the animator dope sheet to create 2d animations? that animation created in the dope sheet is used by animancer.
     
  49. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    @Gamingbir You don't need Animator Controllers with Animancer, the whole reason I made it was to avoid using them.

    @craigjwhitmore You can just select the Sprites you want and drag them into the Hierarchy, but it's not the best workflow with Animancer since it creates a bunch of things you don't need.

    I just added a documentation page about Sprites which explains that and has a script you can download to add a context menu function that will generate animations from all Sprites in a texture asset based on their names. It's a really simple script so feel free to take a look at it and let me know if you make any modifications so I can get an idea of how you want it to work.
     
    Gamingbir likes this.
  50. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    197
    Thank you for clarifying. It seems the plugin is more focused on 3D games. So many examples with 3D but only a small section about 2D. Hope you make some 2D stuff in future.