Search Unity

[DEPRECATED] Anima2D - Advanced 2D Skeletal Animation Plugin

Discussion in 'Assets and Asset Store' started by sergi_mandarina, Nov 21, 2015.

Thread Status:
Not open for further replies.
  1. ManaPotionStudios

    ManaPotionStudios

    Joined:
    Dec 26, 2016
    Posts:
    16
    Hi! I wanted to share small fix for character X scale. Did not know if anyone fixed/occurred it before.

    When you will try to turn unity chan from samples to look left, with scaleX = -1 it will broke it like this:



    To look it like this:


    You need to add scale multipler into SpringBone.UpdateSpring.

    right after line:

    //stiffness
    Vector3 force = trs.rotation * (Vector3.right * stiffnessForce) / sqrDt;

    add:

    force *= scaleX;

    You can pass scaleX into UpdateSpring:

    public void UpdateSpring (float scaleX)

    You can pass this parametr from SpringManager:

    springBones .UpdateSpring (m_scaleX);

    And you can get that scale from Transform you need:

    public Transform m_followThisTransformScaleX;

    if(m_followThisTransformScaleX != null)
    {
    m_scaleX = Mathf.Sign(m_followThisTransformScaleX.transform.localScale.x);
    }

    Hope it will help someone!
     
  2. qugon

    qugon

    Joined:
    Mar 29, 2015
    Posts:
    10
    Hi Sergi, sorry I ran into another issue today.

    The character I'm working on looks fine on my computer, but looks messed up on others. An image for comparison

    001.png
    It looks like each sprite mesh has all the sprites under the same packing tag crammed into it. Also the number of sprite meshes affected vary on different computers, for example, on another computer, only the legs are affected

    They also get some errors

    螢幕快照 2017-03-24 12.29.32.png
    螢幕快照 2017-03-24 12.30.06.png 螢幕快照 2017-03-24 12.29.52.png 螢幕快照 2017-03-24 12.29.59.png

    Thanks in advance!
     
  3. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Does it work without the packing tag?
     
  4. qugon

    qugon

    Joined:
    Mar 29, 2015
    Posts:
    10
    Hey there! First of all, yes, we removed the packing tag on my colleague's files and it worked immediately. We then added the tag back and it continued to work. We then checked git and the changelog shows that the sprite meta files were updated with new iOS import settings, which makes sense, because I didn't install an iOS build module, while my colleague did. So did my lack of iOS import settings mess up the meta file for the other people who did?
     
  5. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    If removing the tag and adding it again worked, I would try then deleting the atlas cache in the library folder to force full atlas recreation.

    Anima2D adds a timestamp to the userData property of your texture importer to change the hash of your meta every time you apply changes in the SpriteMeshEditorWindow. That way the atlas system will see something changed and repack your sprites.

    If both computers have the same meta files in the textures and you import new SpriteMeshes with new geometry in one of them, the atlas system will not repack by default because nothing in the texture's meta changed.
     
  6. DarkSlash

    DarkSlash

    Joined:
    Sep 30, 2011
    Posts:
    128
    Any update on free-form deformation?
    Right now is doing any king of mesh deformation? Because when the T-rex moves his head up and down it seems to be some stretching on the neck, is this right?
     
  7. qugon

    qugon

    Joined:
    Mar 29, 2015
    Posts:
    10
    Hi Sergi, thanks for the reply!

    After we 'fixed' the issue by removing and adding the packing tag last time, the problem reappeared on another computer, so we deleted the atlas cache and allowed Unity to recreate, but for some reason it didn't work.

    We removed the tag again, and the problem was gone, but this time after adding the tag back it broke again. Only after giving the sprites a different tag resolve the issue.

    So we're still somewhat unsure how and when the meta updates, and how we could consistently force updates.
     
  8. qugon

    qugon

    Joined:
    Mar 29, 2015
    Posts:
    10
    Hello Sergi, just an update on the question

    You mentioned that the userData property is updated when there are changes in the spritemesh, however our UnityChan atlas is frequently shown to have updated userData even though we've never touched it, which adds to the confusion. Could this be related to our problem?

    Thanks again.
     
  9. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Skinning produces nice deformation in the T-rex neck, but it is not free form deformation. Free form deformation is another thing.

    The atlas can only be created with wrong UVs if the sprite geometry override failed. Every time a texture is imported, all it's sprites are processed and Anima2D will override the geometry of the sprites affected by a SpriteMesh. You can verify that by instantiating a sprite and checking the wireframe in the scene. If the sprite has your geometry then the created atlas will match. If your sprites show correct wireframe and you trigger the AtlasPacker by deleting the AtlasCache and still you get the old results, I wander if you could send me a video reproducing the problem and a small repro project. You should be able to get a working condition atlas using the same tag.
    Another way to trigger the Atlas Packer is opening a SpriteMesh in the SpriteMeshEditor, hit Apply and play.

    The userData timestamp nowadays is set in "OnPreprocessTexture" event. That will change the userData every time the texture is reimported. I moved it to "ApplyChanges" instead, and the meta was effectively preserved after regular texture reimport and the Atlas Packer was triggered properly. This is a more convenient way to avoid unnecessary changes to meta-files, but I don't know if this will solve the multi-pc problem.
     
  10. AlbertoSupertramp

    AlbertoSupertramp

    Joined:
    Mar 30, 2017
    Posts:
    7
    Greetings,
    I'm trying to bake some animations but i have the follow error inside the unity editor:

    "ArgumentException: Set Method not found for 'recording'
    System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:319)
    System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/PropertyInfo.cs:102)
    Anima2D.AnimationWindowImpl_51_52_53.set_recording (Boolean value) (at Assets/Anima2D/Scripts/Editor/AnimationWindowExtra/AnimationWindowImpl_51_52_53.cs:119)
    Anima2D.AnimationWindowExtra.set_recording (Boolean value) (at Assets/Anima2D/Scripts/Editor/AnimationWindowExtra/AnimationWindowExtra.cs:65)
    Anima2D.AnimationBaker.BakeAnimation () (at Assets/Anima2D/Scripts/Editor/AnimationBaker.cs:27)"

    I work on linux with the latest unity build. 5.6.0xf3

    Thank s for this great Asset
     
  11. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Hi,thanks for reporting.
    Anima2D compatible with 5.6 is not yet in the assetstore. It will be uploaded soon.

    Thanks for your patience
     
  12. AlbertoSupertramp

    AlbertoSupertramp

    Joined:
    Mar 30, 2017
    Posts:
    7
    Hi, do you think i should downgrade to unity 5.5? I can t wait too long.. I noticed also that onion skin doesn t work anymore.
     
  13. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    It is already in the store!
     
  14. Kalpox

    Kalpox

    Joined:
    Jan 17, 2017
    Posts:
    2
    Sans titre.png Hi everyone, i'm posting here because i'm making some characters with Anima2d for an upcoming Game, I made and animated my character without trouble, and it works when I press the play button, but I get the following errors. I must have done something wrong because these are no errors related to unityChan, only to my character.
    And the strange thing is that I get these errors even if my prefab is not into my scene !
    I'm curently working on Unity 5.6, and reimported Anima2d about 3 hours ago.

    Thank you all for your help ! :)
     
  15. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Hi, can you send me your project?
     
  16. Kalpox

    Kalpox

    Joined:
    Jan 17, 2017
    Posts:
    2
    Hi, and thank you for your help, as you requested i'm sending you a package with my animated character in the middle of an empty scene.

    And I also had some errors using the "mesh combiner", maybe I used it the wrong way ? If you could quickly explain me how to use it properly this would be awesome !
    Don't hesitate if ou have any question :)
     

    Attached Files:

  17. Rothana

    Rothana

    Joined:
    Jan 22, 2016
    Posts:
    11
    Hi, I don't know if it's just me but while animating when move a control of a bone and undo the character become messed up. and some time after undoing the key was removed but when i play the action is still there. but all of the problems will go away after restarting unity.

    I'm using Unity 5.6.0f3
    I've already updated to the latest Anima 2d from asset store.

    Thanks.
     
  18. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    We are aware of this issue. Next 5.6.0p1 should include the fix.
     
  19. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Hi, textures imported with mesh type "Full Rect" instead of "Tight" will produce a "Not allowed to override geometry on sprite" error. Please switch Mesh Type to Tight instead in your texture importer options.

    (This is my fault, this is important and it is not in the docs)
     
    carldevelopsforcoffee likes this.
  20. Rainbirth

    Rainbirth

    Joined:
    Aug 3, 2013
    Posts:
    110
    Hi, any way to get a part flipped? I mean I'm trying to get a leg that uses symetry, but I can't get it to work, any time I reasign the bones the sprite flips as it was in the original, and bones don't work with Y scale to -1.

    Is there a way to work with sysmetry?
     
  21. fabioColombini

    fabioColombini

    Joined:
    Dec 9, 2013
    Posts:
    30
    I read that Spring bone is not a feature of Anima2D in an old post.
    But...anyone knows where to find doc about it? How to use Spring collider or how to collide the spring bones?

    thanks
     
  22. YKpro

    YKpro

    Joined:
    May 14, 2013
    Posts:
    12
    We found that when using "Skinned Mesh Combiner" scripts , all sprites lost it's color tint information. Is there any way that we can use "Skinned Mesh Combiner" without losing the color tint info and save drawcalls ?
     
    nosajtevol likes this.
  23. YKpro

    YKpro

    Joined:
    May 14, 2013
    Posts:
    12
    Hi sergi:
    i am using unity5.6 and i have a character using skinned mesh combiner script, but my sprites sorting order went all wrong. it turned out that the order became the list order of Sprite Mesh Instances.
    is this a bug or it is designed like this?
     
  24. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Rotate on the Y axis instead of scaling.

    The current Skinned Mesh Combiner example component is very simple and naive. You could definitely improve it and set the vertex color.

    It is the intended behavior.
     
    YKpro likes this.
  25. GrzegorzPedrycz

    GrzegorzPedrycz

    Joined:
    Mar 8, 2015
    Posts:
    6
    Any chance for FFD animation tool to Anima in near future ? I am more than sure that everyone will agree that is last piece we need ito bring that plugin as ultimate animation tool ;)
     
  26. AlbertoSupertramp

    AlbertoSupertramp

    Joined:
    Mar 30, 2017
    Posts:
    7
    Hi, just to report, auto calculate weight doesn t seems working on unity 5.6.0xf3 linux release. No errors when the button is clicked. Any chance to get it working or fix it?

    thanks.

    Edit: I didnt see the error.

    DllNotFoundException: Anima2D
    Anima2D.BbwPlugin.CalculateBbw (UnityEngine.Vector2[] vertices, Anima2D.IndexedEdge[] edges, UnityEngine.Vector2[] controlPoints, Anima2D.IndexedEdge[] controlPointEdges, System.Single[,]& weights) (at Assets/Anima2D/Scripts/Editor/BbwPlugin.cs:63)
    Anima2D.SpriteMeshCache.CalculateAutomaticWeights (System.Collections.Generic.List`1 targetNodes) (at Assets/Anima2D/Scripts/Editor/SpriteMeshCache.cs:959)
    Anima2D.WeightEditor.DoWindow (Int32 windowId) (at Assets/Anima2D/Scripts/Editor/WeightEditor.cs:135)
    UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) (at /home/builduser/buildslave/unity/build/Runtime/IMGUI/Managed/GUILayout.cs:497)
    UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) (at /home/builduser/buildslave/unity/build/Runtime/IMGUI/Managed/GUI.cs:1817)
    UnityEditor.EditorWindow:BeginWindows()
    Anima2D.SpriteMeshEditorWindow:OnGUI() (at Assets/Anima2D/Scripts/Editor/SpriteMeshEditorWindow.cs:197)
    UnityEditor.DockArea:OnGUI()
     
  27. GrzegorzPedrycz

    GrzegorzPedrycz

    Joined:
    Mar 8, 2015
    Posts:
    6
    I have the same problem now , any way to fix that or i did something wrong ?
     
  28. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    Hi,
    Love Anima2D so far! But just before I got to animate my finished rig this problem showed up. I'm using Unity 5.6.
    The IK limb works fine on 3 of 4 legs. On one of them it still works fine, but not in play mode. Have tried to create new ones but the same happens. Please see attached images. Excact same setup where the last image is in Play mode the toe tips down. Thanks for any help on this!
     

    Attached Files:

  29. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    I solved it myself :) Creating the IK limbs from TOE and last the LEG did the trick. Creating IK limbs from LEG and then TOE was not working
     
  30. Quetzal_Studios

    Quetzal_Studios

    Joined:
    Jan 2, 2017
    Posts:
    7
    When freezing the game using Time.Timescale = 0, Anima2D spring bone positions go back to default.
    Is there a slightest chance it will be solved somehow?
    Cheers.
     
  31. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    I know, I am sorry but we are not adding more features to Anima2D.

    The cpp dll needed for that was never compiled for linux :( Only Windows and Mac.

    I just tried to reproduce the same problem in 5.6 and I could not. Can you send me more information?

    Be careful! This problem is related to IK execution order. In editor mode I can sort it for you based on the hierarchy of bones, but not in playmode. In playmode that would generate garbage. Instead use the IKGroup component in order to sort the execution of your IKs. Your solution is not safe, maybe in a build it will fail again.

    Time.timeScale = 0 does not freeze the game :) All your components still execute. Try disabling the SpringManager.
     
  32. solo204

    solo204

    Joined:
    Dec 9, 2016
    Posts:
    3
    Hello,

    I have a 2d character that has nested child objects for the torso, upper arm, lower arm and gun. I placed a transform (spawn point) at the tip of the gun which I could see positions correctly when I animate with mecanim using Anima2D. The problem shows itself when I debug.draw a line from the spawn point towards the mouse. It seems intermittently jumping on 2 places (correct location and another). I think it's a bug (nested deep) as it works if I place the transform 2 parent bones up.

    Does anyone have an idea how to fix this?

    Thanks in advance Solo
     
  33. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Can you make a video so we can see? Are you drawing on Update? FixedUpdate? LateUpdate? Are you using IKs at runtime?
     
  34. solo204

    solo204

    Joined:
    Dec 9, 2016
    Posts:
    3
    Okay, the pic below shows the hierarchy, you'll see the "FirePosition" transform as a child of the RLA Bone.


    This is the script attached to the FirePosition which is used to draw a line from the FirePosition & mouse:

    Vector2 firePointPosition = transform.position;

    Debug.DrawLine(firePointPosition, mousePos);


    I only use update to find out if the fire button is triggered, which uses the script above.

    The video shows the FirePosition in focus. You can see, it's not the same position as where the line starts.

    I use IK for the hands and feet.

    VIDEO
     
    Last edited: May 10, 2017
  35. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Try to use LateUpdate. Cannot watch the video because it requires flash player. I am quite confident this problem is not related to Anima2D, so let's continue the discussion in a private message if you don't mind.
     
  36. solo204

    solo204

    Joined:
    Dec 9, 2016
    Posts:
    3
    That did it! Lol.
    Thanks for your help.

    BTW, Anima2D is such an awesome animation tool!
     
    Sergi_Valls likes this.
  37. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Hi! Is there a way to assign different sprites at runtime? For example, I have a character with open eyes and closed eyes sprites. Can I replace each other at runtime using Sprite Mesh method? I just don't understand how to do that. If you try to replace the mesh in Sprite Mesh Instance, then it will break all the bones. Is there a way to do so?
     
    Last edited: May 13, 2017
  38. Chrsteam

    Chrsteam

    Joined:
    Oct 3, 2016
    Posts:
    5
    Hi! Recently I've discovered a very weird bug:

    In animation mode IK CCD2d works just fine. But when I hit Play - some mess happens. I can fix it with switch on/off current IK, but it's kinda annoying to do all the time. It also helps to bake an animation - but sometimes I need an original one.

    Is there a reason why it happens? Can it be fixed in proper way?
    ada.jpg
     
  39. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Try SpriteMeshAnimation component.

    Don't use IK at runtime. If you do, you need to use IKGroup component to sort them properly.
     
  40. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Thank you very much.
     
  41. bianchengxiaobei

    bianchengxiaobei

    Joined:
    May 21, 2017
    Posts:
    5
    Hi!
    I have a preblem when I use the tool.
    sorry,my english is bad!
    I make an EditorWindow for myself.Inside I have a TextFiled,When I Input a word beginwith 'L',It's not compatible with your tool.
    I can not continue to input any words.
    It is Immediately stop,and I can only type in one char "L",
    so can you explain why?
     
  42. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Hi, can you please send me some code to reproduce the problem?
     
  43. bianchengxiaobei

    bianchengxiaobei

    Joined:
    May 21, 2017
    Posts:
    5
    Code (CSharp):
    1.  EditorGUILayout.BeginVertical();
    2.                 this.scriptName = EditorGUILayout.TextField("脚本名字", this.scriptName);
    3.                 this.uiPrefab = EditorGUILayout.ObjectField("UI预制物", uiPrefab, typeof(UnityEngine.Object), true);
    4.                 this.bIsResident = EditorGUILayout.Toggle("是否常驻内存", this.bIsResident);
    5.                 EditorGUILayout.Separator();
    when I input some char into the TextField, It forces me not to type in and finish.So I can only input 'l'.
     
  44. bianchengxiaobei

    bianchengxiaobei

    Joined:
    May 21, 2017
    Posts:
    5
    Just Like this picture.I can't input any more char When the word beginwith 'l'.
     

    Attached Files:

  45. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    I prefer if you send me a unitypackage with the code so I can try. Pasting few lines here does not help.
    I tried this example https://docs.unity3d.com/ScriptReference/EditorWindow.html and it works ok. Could you try it as well?
    Thanks
     
  46. Chrsteam

    Chrsteam

    Joined:
    Oct 3, 2016
    Posts:
    5
    Thanks!
     
  47. kostet1977

    kostet1977

    Joined:
    Mar 30, 2015
    Posts:
    11
    Hi,
    any chance to replace the sprite in previously created and binded mesh?
    Or possibly to copy the whole mesh to another sprite?
    The main point that I want to reach is to have two absolutely identically working meshes with the different sprites (parts of multiple sprite).
     
  48. bianchengxiaobei

    bianchengxiaobei

    Joined:
    May 21, 2017
    Posts:
    5
    My codes is packed into DLL.so I send you a unitypackage but you can't see the codes.
    I send you a gif about this case.
    When I wirte a word beginwith 'l' or 'Log',It forced interrupt input and continue execution my code.So it have some errors.
    The key is why I wirte a word beginwith 'l' and 'Log',It would forced interrupt.
     

    Attached Files:

  49. xtyler

    xtyler

    Joined:
    Dec 8, 2012
    Posts:
    12
    Hi Sergi - I'm trying to create some foreshortening (eg when an arm gets smaller when pointing toward the camera) by changing the bone length. Unfortunately changes in bone length don't scale the SpriteMesh. Do you have any ideas on how I might approach this? Scaling X doesn't work because it messes with all the children, which may be rotated etc.

    I'm comfortable getting into the Anima2D code to make changes if you have any suggestions. On that point, is there a repo I can suggest fixes or improvements I make? (eg Bone2D.color set { color = color; } I've fixed to set { color = value; }). I'm building solutions off of Anima2D and would love some insight into future changes, like why is m_Child commented as //Deprecated?
     
  50. Sergi_Valls

    Sergi_Valls

    Unity Technologies

    Joined:
    Dec 2, 2016
    Posts:
    212
    Hi, I need some code that reproduces the problem. I also need the error displayed in the console. I see the nullref comes from managed c# code, method EditorTool.GetScriptOfType. This method is not part of Anima2D nor Unity scripting API.

    Try duplicating the SpriteMesh and setting the new sprite in the inspector.

    Bone length does nothing but provide information while computing the weights. SkinnedMeshRenderer works using regular transforms that don't have length. You can try skinning a child at the end-point of the bone so when the child moves along the x-axis of the parent bone the geometry follows and stretches.
    Any fix you want me to include just send me a private message.
    Anima2D 1.1.0 changed how the information was stored so I introduced an automatic asset upgrader. Some deprecated things come from that. Other deprecated things comes from old SpriteMeshInstance storing Bone2D components instead of Transform components. I had to keep old Bone2D references and somehow make the API return the Transform and store it. Some day I will clean up the deprecated fields. There are no future changes more than fixing bugs like the one you mentioned.
     
Thread Status:
Not open for further replies.