Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

【Spine Animator】- Boost your animations to insane level without any effort!

Discussion in 'Assets and Asset Store' started by FimpossibleCreations, Oct 15, 2018.

  1. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    So I am currently running into two small issues using spine animator. I am running a project with a lot of spine animators and I am getting spammed by the following Debug.Log.

    Code (CSharp):
    1. Look rotation viewing vector is zero
    2. UnityEngine.Quaternion:LookRotation(Vector3, Vector3)
    3. FIMSpace.FSpine.FSpineAnimator:CalculateSpineBehaviourRotation(Int32) (at Assets/FImpossible Games/Spine Animator/FSpineAnimator.cs:1131)
    4. FIMSpace.FSpine.FSpineAnimator:CalculateMotion() (at Assets/FImpossible Games/Spine Animator/FSpineAnimator.cs:1002)
    5. FIMSpace.FSpine.FSpineAnimator:SpineMotion() (at Assets/FImpossible Games/Spine Animator/FSpineAnimator.cs:710)
    6. FIMSpace.FSpine.FSpineAnimator:LateUpdate() (at Assets/FImpossible Games/Spine Animator/FSpineAnimator.cs:568)
    Its of course not an error but it seems to slow down thing in the editor. I also assume this is more like a unity things, because of the vector hitting 0. But I wonder if there would be a way to avoid the message spamming in the editor.

    The second issue is an actual error. That is probably related to the custom pivot and nested prefabs:


    Code (CSharp):
    1. Cannot set the parent of the GameObject 'Creature_Walking01' while its new parent 'CreatureWalkinTestDummy (7)' is being destroyed
    2. UnityEngine.Transform:SetParent(Transform, Boolean)
    3. FIMSpace.FSpine.FSpineAnimator:RestoreBasePivotChildren() (at Assets/FImpossible Games/Spine Animator/FSpineAnimator.cs:1553)
    4. FIMSpace.FSpine.FSpineAnimator:OnDestroy() (at Assets/FImpossible Games/Spine Animator/FSpineAnimator.cs:1531)
    Im using multiple copies of the CreatureWalkinTestDummy Prefab. This error only appears on load, and does also not stop the game from running in editor. So its seems to be only a minor issue.
     
    Last edited: Nov 14, 2019
  2. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Yeah "Look rotation viewing vector is zero" is hard to reproduce, sometimes it need only to put "if (targetDirection != Vector3.zero)" but not always saves you.
    I will check this cases in next week, in this one I have a bit too many stuff on my head :(
     
  3. Lewnatic

    Lewnatic

    Joined:
    Sep 29, 2012
    Posts:
    209
    No worries. Its just a small issue. :) Any idea what the second issue might be?
     
  4. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Last weeks I was working on tutorial videos, there will be about 6 more (not including manual videos) I will publish them soon week by week ;)
    And there is new manual video explaining essential parameters of Spine Animator with examples:
     
  5. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Hey Clagrens, you can check this tutorial, it's not yet officialy published but feel free to check it:
     
    clagrens likes this.
  6. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Hey Amaltheia, I was checking how it could be done and It seems with spine animator it can be problamatic but possible.
    With tail animator it can be easier to get, but anyway it would need some time to make it work.
    Anyway I probably will try to add possibility to change length of bone chains in playmode, but not shure when I will finish it.

    I think making it not execute when application is quitting can solve it, but not sure, next update will try fix this issues.
     
  7. amaltheia

    amaltheia

    Joined:
    Feb 4, 2015
    Posts:
    5
    That's great to hear! Thank you for your helpfulness!
     
  8. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
  9. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    850
    Hi. Do your assets work well with Emerald AI?
    Love the look of the spine and tail animators. I have some good ideas for using these but I use Emerald AI to control my AI in the scene. I assume it will work but want to be sure.
     
  10. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Yes, this assets needs only object movement to work ;)
     
    dsilverthorn likes this.
  11. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,272
  12. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Your Unity's Animator probably gets disabled after your creature is playing death animation, that's why it is spinning. Best solution would be blending to keyframed animation when death animation is played,
    to do this you can use code like this (changing 'Blend to original' from 0 to 1 in given duration)

    Code (CSharp):
    1.    
    2.     // Your code, executing death
    3.     void Death()
    4.     {
    5.         StartCoroutine(FadeOutSpineAnimator(1f)); // Running procedure to blend out spine animator motion (component in which this code is launched must be enabled)
    6.     }
    7.  
    8.     // Blend out procedure
    9.     System.Collections.IEnumerator FadeOutSpineAnimator(float duration = 1f)
    10.     {
    11.         FIMSpace.FSpine.FSpineAnimator spine = GetComponentInChildren<FIMSpace.FSpine.FSpineAnimator>();
    12.  
    13.         if ( spine)
    14.         {
    15.             float elapsed = 0f;
    16.  
    17.             while (elapsed < duration)
    18.             {
    19.                 elapsed += Time.deltaTime;
    20.                 spine.BlendToOriginal = Mathf.Min(1f, elapsed / duration);
    21.                 yield return null;
    22.             }
    23.  
    24.             spine.enabled = false;
    25.         }
    26.  
    27.         yield break;
    28.     }
     
  13. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,272
    That worked thanks!
     
  14. Theomaniacal_

    Theomaniacal_

    Joined:
    Sep 5, 2019
    Posts:
    5
    I've been loving the Spine Animator so far - easy to use and seems quite performant!

    I have one question regarding animals with Spine Animator being parented to moving platforms. I am parenting the animal to a moving platform, so that the animal will move along with the platform. As you can imagine, the Spine Animator seems to respond to the global position of the animal, rather than the local position of the child animal. Any ideas on how Spine Animator can be changed to account for this?

    Thanks!
     
  15. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Thank you!
    I see, it can be hard but have an idea how to fix this.
    I will work on that soon.
     
  16. Theomaniacal_

    Theomaniacal_

    Joined:
    Sep 5, 2019
    Posts:
    5
    @FimpossibleCreations Appreciate the quick response! Feel free to let me know if I can help test this in any way.
     
  17. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,466
    If you don't mind, would it be possible that you show how to setup this free whale?

    https://assetstore.unity.com/packages/3d/characters/animals/humpback-whale-3547

    I bought Spine Animator today and had lots of troubles with this. The tail was twisting like crazy and such. In the end it all worked when i started to use the bones from the mid of the whale. It would be sufficient if you just show the proper settings.

    By the way, there seems to be a bug. I definitely didn't set the root gameobject there where the red arrow is. It just appeared:

    bugsa.jpg
    Otherwise, very impressive asset, great work!
     
  18. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Right now I can't check but I remember, this model was facing z axis in opposite direction, so you can create empty game object, put inside whale, zero position and scale, but rotate in y axis by 180 degrees.
    Add spine animator to this new empty object, but sorry that I can't check it in this moment to confirm :rolleyes:
     
  19. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,466
    Thanks, I did that already, that's why the Spline Animator is in the Whale Controller gameobject. No rush, but if you find the time I'd appreciate if you show how this works. At first it looks fine when I hit play mode, but as soon as I move the whale the tail spins like crazy:

    bug.jpg

    I tried to adjust the smoothing, straighten etc settings, but it just keeps happening.
     
    dsilverthorn likes this.
  20. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    You can make this model work but it's potential is limited, root bone (bone001) is placed above model, if it would be in front of first spine bone whole motion would look better, also I see some weights for bones could be painted a bit better.
     

    Attached Files:

    Rowlan and dsilverthorn like this.
  21. Alex1337rus

    Alex1337rus

    Joined:
    Mar 30, 2016
    Posts:
    37
    Hi! Is it possible to use spine animator for create "classic rotate animation" (anim files for unity animator) without runtime scripting?
     
  22. icicvrufl

    icicvrufl

    Joined:
    Apr 23, 2019
    Posts:
    2

    Hi, I have a problem about the collision function. I tried to control the spineAnimator object move forward to the wall, but sometimes it would passing through the wall as shown in the video. How can I solve this problem? And my original idea is to control this object inside a pipe with mesh collider and the spine object should not passing through the pipe. Is it possible to do it?
     
  23. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Example movement script in demo assets is not adapted for walking in 360 angles (like on ceiling) I have other package in progress which will offer movement like that, but for now there should be some alternatives on the asset store.

    Second thing are segments colliders for bones, to make round capsule collisions inside pipe I would need to implement something like collision from inside geometry instead of collision on surface. I will add it to task list then, but can't give precise date when it will be implemented.

    So for now I recommend finding right character movement system for your needs, it would solve most of problems.
    When you turn off gravity in creature and would walk over inside of pipe, it wouldn't clip through ground much, you can also experiment by building colliders around pipe for now.
     
  24. icicvrufl

    icicvrufl

    Joined:
    Apr 23, 2019
    Posts:
    2
    Much thanks, I will try
     
  25. undecyce

    undecyce

    Joined:
    Oct 17, 2019
    Posts:
    8
    Hi! This plugin works really nice! Will it support 2d physic sprite bones added in 2019.3 in the future? I see that it has been able to detect and do effects on 2d bones in some way. Maybe disable the rotation of the XY axis and the displacement of the z axis should do the trick?
     
  26. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Spine Animator version 2.0.0 Released!

    Big update, refreshing GUI adding new parameters, optimizing performance and making code much more clear for me for further updates.
    Please remove old directory and import new one again to avoid some compilation errors.
    You can check changelog here:

    Many variables changed, some of them was replaced by other ones.
    If you was using Spine Animator previously, click on objects with Spine Animator to convert them to new version and apply changes.

    - Refreshed inspector GUI
    - Added language support for inspector GUI headers: English, Polish, Russian (translator - t), Japanese (t), Chinese (t), Korean (t)
    - Upgraded scene gizmos to make setting up spine chain easier
    - Refactored code, cleaned and optimized (Now Spine Animator works faster and without garbage collector peaks)
    - Removed many anchoring parameters, now they're not needed anymore everything now is detected automatically
    - No more option for positions and rotations not animated, it's replaced by "Detect Zero Keyframes"
    - Now update rate can be defined for more stable motion / optimization in high/low FPS
    - Added many new small parameters

    New inspector GUI with language support:


    Better Scene Gizmos for easier setup:


    Possibility for backward follow behaviour (controls will be improved in next versions):


    Motion influence possibility for moving platforms:
    https://imgur.com/A77SXDm

    And other small changes.

    Thanks for suggestions, I will look at this after achieving my current tasks (refactoring tail animator and optimizers)
     
    dsilverthorn likes this.
  27. Theomaniacal_

    Theomaniacal_

    Joined:
    Sep 5, 2019
    Posts:
    5
    @FimpossibleCreations Thanks so much for implementing a solution for this! The Motion Influence parameter seems to work well enough for my use cases.

    v2 looks great overall! Easiest decision for me to leave a positive review on the Asset Store.
     
  28. Theomaniacal_

    Theomaniacal_

    Joined:
    Sep 5, 2019
    Posts:
    5
    @FimpossibleCreations I noticed that with v2, I had to set my Go Back Speed value to 0.03 instead of 0.3. I had no issues achieving my desired spine result but was curious if this was something you experienced/intended.
     
    dsilverthorn likes this.
  29. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,063
    Hi there, and thanks for using our assets to demonstrate the power of your tool.
    I'm currently using spine animator in a project. I have to say that what it can achieve is absolutely breath taking.
    That being said I'm having an issue with a character that needs to have its spine and tail animated. I managed to set that up without too much trouble. Though I got confused because of the older videos which don't show the exact same UI etc...
    My issue is pretty weird. My dev set up a prefab of a rideable creature that you can manipulate at run time via key input. For some reason only the tail animates with the spine animator the spine and neck just don't.
    I tried to set up a new prefab with a very bare controller and animator controller. And this time it was reacting exactly as expected. Tail, neck and spine were moving naturally with spine animator...
    So my question is, is there some sort of input that prevent spine animator from working? I set up the 2 prefabs the exact same. The only difference were the input / script to handle them. Another difference is that the prefab that doesn't work correctly doesn't habe the actual script attached to it. At run time, the parent game object that has the input script unchild the actual animated model. Would that be the issue??
    Thanks again for your time and hard work on that stunning asset!!
     
    FimpossibleCreations likes this.
  30. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550

    Also thank you for creating so cool models!
    Would love to test my packages on all of them :D

    You can switch to old UI with this button, but many variables can be removed or name changed (I left this option for working with old tutorial videos):




    There is input stopping Spine Animator work (only for editor) and it's "~" key but I think it's not causing your issue.

    I am not sure if that's the problem, I think I would need short mp4 clip of the issue but...
    When you use multiple Spine Animators the execution order is important.
    When you animate creature's spine bones on keyframe-animated model, transforms are resetting positions and rotations to keyframe animation pose on beginning of every frame. (that us how unity animator works)

    For example when Spine Animator animating tail bones executes before Spine Animator which is animating spine bones then it's motion is dependent on just keyframe animation without spine bends done by other spine animator.

    To avoid that, you enable "Update as last" in Spine Animator which is animating tail bones.



    The "Base Transform" variable must be set to last parent object which is rotating and moving whole game object.
     
    Last edited: Sep 1, 2020
  31. Rio_TFF

    Rio_TFF

    Joined:
    Aug 4, 2019
    Posts:
    21
    Hello,

    Spine asset is broken on 2019.4.9f1 (Built-in).

    When I try to look at demo scenes, the inspector is glitched (see below) and I get an error message. The same happens when I try to attach the Spine Animator component to one of my characters.



    And:



    This happens with all prefabs, and with all demo scenes.

    Any help would be appreciated. Thanks!
     
  32. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Strange, it is not occurring on my side, but I fixed line with error, please try with this mini update
     

    Attached Files:

  33. argoms

    argoms

    Joined:
    Dec 10, 2015
    Posts:
    2
    Hi, I'm running into issues with hitboxes on a model animated by spine animator not updating location. I've got a worm/snake creature with a box collider attached to each bone.

    Collision events seem to work properly (trigger projectile object colliding with non-trigger hitbox object), but raycasts (done every frame) and physical collision (so I can't run through the object) doesn't. Instead, the colliders act like the skeleton isn't being touched by spine animator. If I pause the scene, all the hitboxes look like they're in the right place: wormcollisionissues.png

    But what actually happens is that they act like the creature is in its un-modified straight pose.So instead of colliding with where you see the boxes, the player collides with the area where I drew red lines.

    I've tried changing several options on the Spine Animator 2 component, but nothing seems to really affect this. Any idea what could be going wrong?
     
  34. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Procedural Animation needs to be updated in LateUpdate(), it's not visible but during Update() model is in default animator pose. You would need to do your raycasts in LateUpdate() after Spine Animator motion, then I suggest adding [DefaultExecutionOrder(100)] over class name where you perform raycasts. So rename Update() to LateUpdate() and add execution order.
    Hopes that will help!
     
  35. argoms

    argoms

    Joined:
    Dec 10, 2015
    Posts:
    2
    That worked, thanks.
     
    FimpossibleCreations likes this.
  36. Theomaniacal_

    Theomaniacal_

    Joined:
    Sep 5, 2019
    Posts:
    5
    Just a heads up. When switching over to Unity's new input system, an exception is thrown at Assets/FImpossibleCreations/FSpineAnimator.cs:233. Following code just updates that line.


    // Old input
    // if (Input.GetKey(KeyCode.BackQuote)) { updateSpineAnimator = false; return; }

    // New input
    if (UnityEngine.InputSystem.Keyboard.current.backquoteKey.isPressed) { updateSpineAnimator = false; return; }
     
  37. Quique-Martinez

    Quique-Martinez

    Joined:
    Oct 1, 2013
    Posts:
    141
    Hi, is there any tutorial or video combining spine animator with navmesh agents? thanks
     
  38. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    850
  39. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    I'm currently getting good performance in the editor, but not so good in a build. I'm using Unity 2018.4.

    When profiling my game in a build, I noticed the Spine animator is creating 6.1 kb of GC every frame. Is there anything I can do to make sure that doesn't happen?
     

    Attached Files:

    hopeful likes this.
  40. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Thanks for raport, I will take closer look at it, it shouldn't happen :O

    Edit: Can you please check if now gc alloc is gone in your case? (attached hotfix)
    I found it but on build as well as in editor.
     

    Attached Files:

    Last edited: Jan 22, 2021
    FiveFingerStudios likes this.
  41. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    ill go ahead and try it and let you know
     
  42. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    That seemed to fix it...thanks.
     
  43. fatihkranlootcopter

    fatihkranlootcopter

    Joined:
    Nov 20, 2020
    Posts:
    7
    Hello, i get a NullReferenceException at "SpineAnimator.Logic.Core.cs:281". "headBone" variable is null. I tried to skip that part with null check but it caused more errors.
     
  44. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    When it's happening? You have the newest version from the store? Line 281 is for sure different than in newest version.
     
  45. fatihkranlootcopter

    fatihkranlootcopter

    Joined:
    Nov 20, 2020
    Posts:
    7
    Hello, i updated the asset and it is Line 291 now
     
  46. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Can you tell when it's happening or what you did?
    This error should never appear since this 'head' variable is always filled when component is initializing.
     
  47. fatihkranlootcopter

    fatihkranlootcopter

    Joined:
    Nov 20, 2020
    Posts:
    7
    If i Instantiate the object at OnEnable from other script, this error occurs. I avoided it by waiting fixedupdate.
     
  48. KeesSparnaaij

    KeesSparnaaij

    Joined:
    Jan 19, 2021
    Posts:
    1
    Hi,
    Everytime i put an offset on the 'Main Pivot Offset' (-1 on the Z axis)
    the animations stops playing the animations from the blend Tree I use in my Animator.

    When I reset the offset to 0 they start playing again.

    Does anyone know a fix for this problem?

    thanks
     
  49. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    550
    Connection of unity Animator with model's bones might be broken.
    Can you try put your model in additional parent game object?
    So GameObject with Spine Animator -> GameObjects with mesh, animator, bones etc.
     
  50. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    850
    New Video coming tomorrow. "Apollo's Dream II" Using tons of assets, as usual. The music is always an original composition.

    Hope everyone enjoys it, the scene and music has been in the works for a long time. We are glad we are finally coming to a final product.

    Keep an eye on our YouTube for the new video.
    https://www.youtube.com/user/silverthorndavid/videos
    View attachment 829055
     
    FimpossibleCreations likes this.