Search Unity

Tail Animator - Procedural tail animation for tentacles, simple capes, squids and more!

Discussion in 'Assets and Asset Store' started by FimpossibleCreations, Jul 18, 2018.

  1. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Thanks!
    Waiting to see how you used Tail Animator :D
     
  2. Canthera

    Canthera

    Joined:
    Aug 6, 2019
    Posts:
    2
    Hey there! We've recently acquired Tail and Spine animator and we've noticed that they do not work with optimized model hierarchies but require the bones to be in a regular child-chain. Are there any plans to support flat hierarchies and let us manually add the bone chain? Especially for mobile games, optimized, flat hierarchies (enabling "Optimize Game Objects" in the rig section of a model and manually exposing individual bones) are quite commonly used to reduce the amount of transform updates.
     
    faolad likes this.
  3. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Yes I know about "optimized hierarchy" but this option just removes possibility to make changes on any bone.
    Yes you can add exposed bone but you can only get it's position and rotation but not edit it, you can apply custom positioning and rotating.

    If your models are just tails without keyframe animation, you could hit "Detach children" toggle, it can make motion work 5 times faster thanks to unparented transform hierarchy.

    Soon I will try implement ECS for tail animator which could bring giant boost for the algorithm.
     
  4. ferdi8

    ferdi8

    Joined:
    Feb 24, 2020
    Posts:
    1
    Hello Fimpossible!

    Your asset looks really impressive and I think it will be useful for a number of things in the project I am currently working on.

    I wanted to ask before I bought the package if it would be possible to have dynamic bones that are generated at runtime and still effected by the tail animator.

    The idea is to generate stuff like plants, roots or flowers growing at runtime but dynamically add the bones to the tail chain as they are generated. Do you think this is possible?

    I saw that wenzy in a previous post was using it on a procedurally generated mesh during runtime. I wondered if this was some behind the scenes magic where he had several setups and was just cycling through them or if the tail chain was being procedurally generated and plugged in to the tail animator.

    I'm excited to see how it performs with your plans of implementing ECS, should be amazing!

    Thanks in advance and keep up the good work!
     
  5. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Thank you and Hello!
    Yes it is possible and package includes example demo scenes with such usage.

    Wenzy was generating meshes for tails but using tail animator skinning API to make them bend (skinning in playmode) and then adding tail animator.
     
    ferdi8 likes this.
  6. drjamiearron

    drjamiearron

    Joined:
    Jun 8, 2012
    Posts:
    134
    Hi there, a colleague of mine recently purchased this plugin for me and so far it's working great!

    I haven't checked the documentation thoroughly yet, but when a character is destroyed with the tail object attached a null reference exception is triggered:

    Code (CSharp):
    1. MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. UnityEngine.Transform.get_lossyScale () (at <e2bce5d33e704a76a5c9576f4d43769b>:0)
    4. FIMSpace.FTail.TailAnimatorWind.Update () (at Assets/Plugins/FImpossible Creations/Plugins/Tail Animator/Utilities/TailAnimatorWind.cs:138)
    I'm happy to make a few edits for this to work but wanted to check whether there is a safe, preferred method to destroy a game object with the tail object attached?
     
  7. fkosie

    fkosie

    Joined:
    Apr 15, 2013
    Posts:
    2
    The tail animator is great, however I need to use it for 2D, including collisions, for instance where the tail bends around a 2D object, as is possible in 3D. Is there a way to support this with the current version? I think currently the code for collisions is mostly setup for 3D. If so, is there a plan to add 2D support?

    Thanks!
     
  8. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Thank you.
    Support for collider 2D is not yet considered, but I will check it soon. For now I suggest trying to use 3D colliders in 2D world like in the 2D example scene, but then all sprites must have equal Z axis position.
    I am not sure if 2D polygon collider support will be possible.
     
  9. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Version 2.0.5 Released
    - Added experimental version for 2D collision detection (Polygon collider since unity version 2019.1)
    - Optimized some collision algorithms
    - Added "Animate" Roll toggle (under "Additional Parameters") which will make smooth rotate bones in forward axis (Tail Animator V1 style)
    - Inspector window now is less vertical long, tweak categories are selected in horizontal menu
     
  10. Fooslie

    Fooslie

    Joined:
    Jun 22, 2016
    Posts:
    19
    Hello! Just bought your asset and didn't have an opportunity to explore it in-depth. Visually it works great, but I couldn't find info on detecting collisions in the manual... Is it possible to detect the collision with a tail via script? Like if I want to "punch" an object with a tail and add force on collision or something like that.
     
  11. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Can you describe a bit more what effect you want to achieve?
    If you want tail to interact with other colliders you would need to choose "World" collision space.
    After entering playmode component will add colliders and rigidbodies to all tail segments, it is not as smooth as "Selective" collision space but selective space is only affecting tail object doing nothing to other rigidbodies.
     
  12. Fooslie

    Fooslie

    Joined:
    Jun 22, 2016
    Posts:
    19
    I mean will OnCollisionEnter or OnTriggerEnter work with your tail colliders? For example, if I have an object with a script that has the OnCollisionEnter method in it that checks if a collider with a "tail" tag touches it (one of your tails with collision with this object enabled), will it detect this collision?
     
  13. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Yes, you can simply add sphere colliders to the bones by hand and tag it with "tail" and correct layer (to avoid collision with character which have tail on it)
     
  14. faolad

    faolad

    Joined:
    Jan 27, 2013
    Posts:
    118
    Hello I'm struggling to make tail animator work with optimized model hierarchies. Any help, thanks!
     
  15. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Hello faolad, optimized hierarchies are not capable to be animated proceduraly, it's like baking for animations, we can only get position/rotation of exposed bone but can't change it's transform variables.
    If your model is not animated by keyframes you can try using "detach children" (in setup tab and with not optimized hierarchy) it can give boost in tail animator's performance but it is not working in every case.
     
  16. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Can you please explain how Colliders Layer works. There is not a tool tip and there is nothing in the documentation.

    I would like to be able to define the physics layers I want the Tail to collide with in the world.

    - When I select Collision Space World_Slow and uncheck Colliders Layer, I am able to select the Layermask layers I want but it does not work. Also if you do this, there is a bug if the tail is procedurally generated. You can see the bug by placing the prefab PR_TailDemo2D_LineRendererTentacle into your scene and unchecking Colliders Layer and selecting multiple layers in the Layermask and Press Play
    BUG:
    A game object can only be in one layer. The layer needs to be in the range [0...31]
    UnityEngine.StackTraceUtility:ExtractStackTrace ()
    FIMSpace.FTail.TailAnimator2:SetupSphereColliders () (at Assets/FImpossible Creations/Plugins/Tail Animator/Code/TailAnimator.Extensions.Collision.cs:148)

    Thanks
    Allan
     
  17. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    416
    Is there a way to attach the end of a Tail to another transform and lock it in that position?

    I'm working on using TailAnimator for ropes and it works well with a LineRenderer but I am unable to figure out how to make it work with Mesh segments. The Start Bone can easily be parented to another transform as you have in several of your demos. When I parent the End bone/Last Segment to another gameobject in the scene, it still waves around following the procedural motion of the tail.

    Thanks
    Allan
     
  18. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Sorry for late reply.
    Yeah there was wrong property drawer, this patch should fix it. (I attached file)

    Layer field just changes layer value in bones game objects.

    You can also try using "Selective" collision space with "Dynamic World Colliders Inclusion" it will work in similar way, adding and removing colliders from list with trigger collider.

    You mean connecting beginning bone to one transform and end bone to another?
    Tail Animator is not designed for that but you can try using IK feature, it might not give you desired result thought.
    Maybe in future there will be options for such uses, this package evolved highly since v1.0
     

    Attached Files:

  19. frhtysl

    frhtysl

    Joined:
    Jan 22, 2018
    Posts:
    2
    Hey there, amazing asset! I wanted to check to see how far you are from implementing the component into the DOTS workflow. I'm currently working on a prototype with two approaches in parallel: one with tail animator and traditional unity pipeline; one without tail animator (using shaders instead), using DOTS.

    Now I'm sure I don't need to tell you that a shader can't replace your package, that much is clear :D
    But I'm considering to stop developing with DOTS for this project strictly because tail animator is not working right now and the performance gain is not so much that it warrants sacrificing your package.

    Could you possibly give a rough timeframe as to when you plan on implementing it? It will honestly save me a lot of time (and resources) if you could! Thanks in advance!!
     
  20. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Thanks!
    I tried working with DOTS with tail animator but it seems it will be not possible to get big gain of performance on animated models since built in UNity's hierarchy transforming takes most of the time for the algorithm.
    I've got pretty similar performance when detached hierarchy but for now it will work only on few setups.
    (I've got like 6x better performance on tail with >300 bones when detached hierarchy)
    I will give second shot with new "ConvertToEntity" features in DOTS, since I was testing it on earlier versions.
    When there will be some good result I will give info :)
     
  21. meichen8050753

    meichen8050753

    Joined:
    Jan 16, 2017
    Posts:
    37
    GC when call AnimationCurve.keys.
    when I prefile project and find that AnimationCurve.keys alloc 34mb gc in short game runtime
    QQ20210202-155735.png
    And I use a cache to cache the animationCurve keys replace get keys everyframe, Will this cause other problems ?
     
    Last edited: Feb 2, 2021
  22. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Wow, I just realized accessing AnimationCurve's keys allocates memory, I changed it to just evaluate curve and it's fixed.
    Please apply this fix to get rid of allocating.
     

    Attached Files:

  23. frhtysl

    frhtysl

    Joined:
    Jan 22, 2018
    Posts:
    2
    Good to hear! There is an animation samples github that has some examples of converting skinned meshes to DOTS so maybe that could be helpful? I tried to implement your plugin using these but I gave up...

    Also, would there be a quick way to implement the C# job system workflow into your package? I've been thinking that multihreading (if you're not already doing it) could drastically improve performance without having to even use the DOTS stuff...
     
  24. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Thanks for the link, I will check it out.
    I will give another try for jobs and DOTS, last time I tried it was kinda mess for changing code to work only with structs.
    Now I have some ideas how can I manage it more clearly, maybe this time it will finally work right.
    Right now I am pretty busy on some another system and when I will be done with it I will try improving this package ;)
     
  25. cdy_unity

    cdy_unity

    Joined:
    Jul 28, 2017
    Posts:
    9
    Hey there!
    I have a 2D game ,I don't want to use worldPosition, How can I use my own node to drive child nodes。

    Sorry, my English is not good
     
  26. Joshdbb

    Joshdbb

    Joined:
    Oct 28, 2014
    Posts:
    50
    I am trying to run the examples but all I am seeing is a static scene. Does this package work with URP?

    upload_2021-3-27_20-32-35.png

    The 2D examples seem to be working fine.

    Edit:

    The meshes seem to be missing:
    upload_2021-3-27_20-53-12.png
     
    Last edited: Mar 27, 2021
  27. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Yeah I saw this, and it's caused somehow by unity version, Initially I upload it with Unity 5.6.0 and for some reason this scenes are wrongly interpreted by newest unity.
    Adding mesh should solve this, I will need to re-create this demo scenes and reupload, I hope that will work.
     
  28. Grant151

    Grant151

    Joined:
    Sep 12, 2013
    Posts:
    65
    Hey! I just downloaded the Tail Animator 2 and trying to make a cape with it. Everything seems fine, except the fact that when I move the character the cape movement is very jagged and studdering. My player a rigidbody moving in fixed update. I tried switching through different "delta types", toggling "Update as last", enabling interpolation, but its all the same. Any ideas how to fix the jagged movement?
     
    Last edited: Apr 21, 2021
  29. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Can you try switching "Interpolate" field in rigidbody to "Interpolate" ?
    Also opened inspector window can generate some jagging, so it's better to test animation with object deselected.
    There is demo example scene "S_Demo_TailAnimator_Insect" with objects moving using rigidbody and with tail animators attached to bones, you can check it too.
     
  30. Grant151

    Grant151

    Joined:
    Sep 12, 2013
    Posts:
    65
    I've tried toggling "interpolate" on the rigidbody and it has no effect, and yes, I always deselect objects in play mode since it removes so much overhead. Since nothing worked, I assume the problem is with my character controller being jagged itself, but thanks anyway!
     
  31. Zillus

    Zillus

    Joined:
    May 31, 2017
    Posts:
    24
    I've been playing with this for a few hours and I am very impressed so far. I am struggling to work out one thing. I am using it for tentacles with inverse kinematics. Is there a way to make it stretch if it cannot reach the IK target? There are stretching options but I can't seem to find a combination that will make it stretch for IK.

    I can probably hack a solution by increasing the Length Multiplier based on distance from the end bone to the target but I thought I would ask before I tried working that out.
     
  32. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Stretching to reach target point will be implemented in future versions, but for now I suggest trying working with length multiplier parameter as you said ;)
     
    Zillus likes this.
  33. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Hi there,

    I just go this, and I'm having a little issue.
    Everything seems to work, except when my player gets close to the meshes (for testing purposes I'm just doing copy/paste of a PR_TailAnimator into a scene) the tails just stop animating and I get this:
    My player is a character controller with a sphere and a rigid body inside.
    How can I fix this?
    Thanks!

    NullReferenceException: Object reference not set to an instance of an object
    FIMSpace.FTail.TailAnimator2.BeginCollisionsUpdate () (at Assets/FImpossible Creations/Plugins/Tail Animator/Code/TailAnimator.Extensions.Collision.cs:101)
    FIMSpace.FTail.TailAnimator2.UpdateTailAlgorithm () (at Assets/FImpossible Creations/Plugins/Tail Animator/Code/TailAnimator.Logic.UpdateStacks.cs:76)
    FIMSpace.FTail.TailAnimator2.LateUpdate () (at Assets/FImpossible Creations/Plugins/Tail Animator/TailAnimator2.cs:173)
     
  34. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    It seems there is some null object in collisions lists.
    Can you please check if this patch fixes it?
     

    Attached Files:

  35. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Thanks, I fixed it by changing the tag of the objects.
    I will try the patch next.
    I'm having a build error in Unity with this message :

    Code (CSharp):
    1. Assets\FImpossible Creations\Demos\Demo - Tail Animator V2\Scripts\TailDemo_SkinnedMeshGenerator.cs(1,16): error CS0234: The type or namespace name 'FEditor' does not exist in the namespace 'FIMSpace' (are you missing an assembly reference?)
    What can I do to fix this?
    Thanks!
     
  36. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Thanks for raport, you can simply fix it by moving one line a bit lower
    upload_2021-5-12_16-45-2.png
    I am not sure why this line went up, in demo package for lower unity versions it's in right place, I will include this fix in next update.
     
  37. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Yup, this did the trick.
    Thank you very much! :)
     
  38. Joshdbb

    Joshdbb

    Joined:
    Oct 28, 2014
    Posts:
    50
    I have a couple of things that I would like to implement using Tail Animator but I'm not sure how.

    1.
    I currently have a humanoid character that has a tail animator applied to the spine/head so that the character leans back when you run around (this looks great). I also have jump pads that shoot you up very fast when you stand on them.
    The issue that I'm having is that when the player jumps up very fast their head leans back too far and disappears into the body.
    Is there a way to limit the movement so that they head doesn't lean too far?
    I assume I need to use the 'Limiting Motion' options but I can't seem to get it to work. No matter what I set it to the head still goes inside the body. Maybe I am misunderstanding something. I don't really understand what the options are supposed to do.

    2.
    I have moving platforms. Currently when the character is standing stationary on the moving platform they lean because the platform is moving. I would like for this not to happen. I would like the tail animator to only respond to the movement of the player actively running around.
    Is there a way to feed a movement/velocity vector into the tail animator so that I can control which movement it responds to?

    Any pointers would be much appreciated, thanks.
     
  39. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540

    One thing you can try is setting "Motion Influence" pretty low when character is moving faster, it will put much less force to tail animator bones (Max stretching also should be lower than 0.4).
    Angle limit should limit how much each bone can rotate, and with lower options you can limit rotations to limit only rotating forwards or backwards / to sides etc. but I think you should focus just on "Motion Influence"



    For moving platforms I prepared script for you.
    You need to enable this script when your character jumps on platform, it's up to you how you set it up.
    Script needs tail animator component which will not be affected by platform, also script needs reference to moving platform transform (in addition blend slider to define if you want fraction of motion effect on the tail)



    Here's code:
    Code (CSharp):
    1. using FIMSpace.FTail;
    2. using UnityEngine;
    3.  
    4. public class TailAnimator_CompensateMovingPlatform : MonoBehaviour
    5. {
    6.     public TailAnimator2 tailAnimator;
    7.     public Transform movingPlatform;
    8.     [Range(0f, 1f)] public float LimitBlend = 1f;
    9.  
    10.     Vector3 prePos;
    11.  
    12.     private void Start()
    13.     {
    14.         prePos = movingPlatform.position;
    15.     }
    16.  
    17.     void Update()
    18.     {
    19.         if (tailAnimator.IsInitialized == false) return;
    20.  
    21.         Vector3 platOffset = (movingPlatform.position - prePos) * LimitBlend * tailAnimator.MotionInfluence;
    22.  
    23.         for (int i = 0; i < tailAnimator.TailSegments.Count; i++)
    24.         {
    25.             tailAnimator.TailSegments[i].ProceduralPosition += platOffset;
    26.             tailAnimator.TailSegments[i].PreviousPosition += platOffset;
    27.         }
    28.  
    29.         prePos = movingPlatform.position;
    30.     }
    31. }
    32.  
     
    Last edited: May 20, 2021
    Joshdbb likes this.
  40. Joshdbb

    Joshdbb

    Joined:
    Oct 28, 2014
    Posts:
    50
    Thanks for the help.

    Thinking about it, for my first issue what I really want is for the tail animator on the spine to not be influenced by motion in the y direction. Is there a built in way to do this? If not then I should just be able to use the solution for the second issue to cancel out the y motion.

    For the second issue, I quickly tried to apply the code that you supplied to my project but it just made everything very juddery and unsmooth when standing on the platform. I may have done something wrong in the setup. I will try to do a more isolated test when I find the time.

    Would you mind sharing your example scene that you are showing in the gif that you posted? It may help me to track down the thing that I did differently in my setup.
     
  41. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Well it needed few more modifications after all, I will send you code modifications through pm and I will schedule it for next update ;)
     
  42. RickSaada1

    RickSaada1

    Joined:
    Mar 9, 2015
    Posts:
    17
    Hi, I picked up your Spine and Tail packages today, and I'm trying to animate some 2D tentacles. The Autowaving tentacles look pretty good, and I can get them to collide with things. But I can't get IK driven motion and collisions to work at the same time. If I'm animating towards an animating target location it just ignores collisions completely.
    Is this a bug? Is there some setting I'm missing that I need to make this work? Or are these features incompatible? upload_2021-6-28_16-10-41.png
    Top Tentacle is using IK and just passes right through the sprite and the circle collider 2D. Bottom tentacle is using autowaving and no IK, and it correctly hits the sprite and then flows around the circle collider 2D.
     
  43. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Hello, I checked it and it all works together, In your situation there probably went something wrong with detecting collision since IK tries to enter box collider directly, also box collision is not perfect yet, capsule and sphere/circle collision gives more smooth results, you can also try boosting 'IK smoothing" parameter.
     
  44. RickSaada1

    RickSaada1

    Joined:
    Mar 9, 2015
    Posts:
    17
    Hmmm, I was using a circle collider, but I'll keep poking at it and see if I can make it work.
     
  45. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Are you sure you included this collider to be detected by tail animator? (Tail animator needs to know with which colliders it should compute collision) Or enabled dynamic inclusion? (automatically adding near colliders to compute collision)
    Also you switched to collision 2d? But strange if it all works without IK enabled, are you able to send me in PM small bug repro scene?
     
  46. Vostrugin

    Vostrugin

    Joined:
    Sep 23, 2019
    Posts:
    3
    Firstly, thank you for the great asset. Is it possible to make a joint to one of the segments of the tail? I'm trying to use the asset to emulate plants and want to achieve behavior when you grab and pull a plant in the middle, for example.

    Now I implement something like this with controlling tail segments via script but looking for the simpler way :)
     
    Last edited: Jul 19, 2021
  47. lucy94920

    lucy94920

    Joined:
    Apr 23, 2018
    Posts:
    5
    Hi, thank you for this great plugin, I've used it to make beautiful animations on these wings in my previous project.
    However when I'm now trying to use it to simulate a "whip", I found it often ends in a "wave-like" shape. I have tried adjusting the stifness, unify blendiness and motion influence, but none of them work very well. Do you have any suggestions on this? or will it be mush better if I have less bones on it? Thank you.
    upload_2021-8-12_17-43-47.png upload_2021-8-12_17-40-26.png
     
  48. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    If someone wants to do something similar as Vostrugin we was working on that on the Discord server ;)

    Whip seems to be complex case, I think you could get a bit nearer result using Bones Stimulator, interesting case anyway, I will try adding some new parameter and check how it would work, but for now I have some other high priority tasks in list.
     
  49. Gapa

    Gapa

    Joined:
    Dec 11, 2012
    Posts:
    27
    Do this work with URP?
    i cant get the Editor tail skinner to work in URP.
     
  50. FimpossibleCreations

    FimpossibleCreations

    Joined:
    Jun 27, 2018
    Posts:
    540
    Hmm, I guess you see pink model when using skinner?
    Can you try this shader update?
     

    Attached Files: