Search Unity

EasyMotion2D - Make 2D Skeleton Animation in Unity3D easily.[RELEASED]

Discussion in 'Assets and Asset Store' started by typehm, Oct 18, 2011.

  1. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, ValenUA
    The new features from beta to current version:
    1.) If it is a new API, provides tutorial and API reference maunal.
    2.) If it is a editor, provides video to show how to use it.
     
  2. yadoa

    yadoa

    Joined:
    Oct 24, 2011
    Posts:
    13
    Hi,
    I sent email, attach the sample file for the animation problem.
    and I ask you question again.

    1.
    I want to resize the atlas sheet.
    would like to know how to adjust freely the atlas size.
    I want to force set the size. ex) 64x512, 2048x128, …

    2.
    In such a case increase sprite size with transform scale increase,
    If a sprite included in atlas, the image is distorted.

    $withAtlas.png
    <sprite asset in atlas>

    $withoutAtlas.png
    <did not create a atlas, i want>

    What should I do to obtain a sharp image while using atlas.
     
  3. crystani

    crystani

    Joined:
    Jul 29, 2011
    Posts:
    68
    Hi, typehm.

    Is Sprite(Mesh)Renderer.Clear(); works properly with SpriteAnimation?

    The reason why I am trying to do this is when SpriteAnimation's clip is stopped, the SpriteRenderer has refs to sprites that are loaded for the animation.

    Is Clear Method a proper way of removing sprites that are attached to the renderer? If so I think that this is a bug. (Sprite Renderer is not removing anything after sprite animation is stopped, the renderer's Clear method is called).

    Thanks,
     
  4. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, crystani
    You are right, SpriteRenderer still reference the sprites even call Clear. I will fix this.
    If you need fix this soon, please mail to me.
     
  5. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, yadoa

    1.) Freely adjust atlas size can not support now. I will try to add this feature in next release (0.46).

    2.) You can change the atlas texture filter mode to point.
     
  6. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Any chance of getting zoom slider to the pivot set window in future updates? its the window that opens when you double click sprite asset.

    It sometimes gets hard to setup it with mouse with high resolution screen and small sprites and have to use the number boxes :(

    So far loving this package! :)
     
  7. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, Ostwind
    This feature will add in next release(v0.46).
     
  8. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Very nice :)

    Another question. Should animation events work with latest asset store version?

    I added event to one frame and set function name. Function has right interface with SpriteAnimationEvent parameter and code is just Debug.Log and not seeing it in log. Function is in custom script attached to same gameobject as Sprite Animation is

    edit: hmm in mummy attack animation it has green color on frames with animation but when i add one it does not show green even after save and restart
     
    Last edited: Jan 14, 2012
  9. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, Ostwind
    Animation event works in latest asset store version.
    In current version, for the animation loop reason, will can not fire the event at last keyframe when clip's wrapmode not ClampForever.
    If you really need fire event at last keyframe, then you can change the wrapmode of clip to ClampForever.
    Or you can add the event before the last keyframe.

    If you can not add a event to clip successfully:
    1.) Please try to do it again.
    2.) If still fail, please send me the details how to reproduce it.
     
  10. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Hi,

    Does the green color mark events in editor? I see them in mummy attack anim, but if I add them from menu it doesnt turn green even after save and restart. If i select the frame again after restart and go to menu it allows me to edit or remove it. I can also see it in unlocked animation, event tree but its not working in game.

    I tried again making new project, imported easymotion. Added event to example MrE idle anim and its still not working. Are mixed/blended anims the problem?

    edit: it seems that creating new ones isnt working but the old ones in examples work runtime
     
    Last edited: Jan 16, 2012
  11. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi,

    Yes, if a event add in clip, will mark it as a green box above timeline.

    I tried to create some new animation clips, but I can not reproduce your problems.

    Can you create a example project that can reproduce your problems, and send this project to me?

    My e-mail: typehm@foxmail.com
     
  12. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    I cant get it to work with any project can some one else try too? :(

    I start latest unity, import latest easymotion from assetstore, open 2d platform scene, add debug.log xxx to mummy endattack event, start the game and go to mummys i can see log xxx.

    BUT if i go to editor and add new event the color does not go green and not working in game. If i click menu again i can see edit event now but still no green and not working in game.
     
  13. nab477

    nab477

    Joined:
    Jun 14, 2011
    Posts:
    46
    a question about Depth
    I'm instantiating a SpriteAnimation at runtime (a particle effect) I want it between 2 object
    I do the depth correctly, but for the first frame, it appears on top of the nearer one, the next frame, it returns to the proper position
    (objects at depths 67 56, particle at depth 66)

    however, if i pause the game select the sprite in the editor (hierarchy), it goes back to the right place.
    is there any function i can call to make it appear from the first frame at the correct position ?

    (I realize I might work around that by having an invisible (alpha = 0) first frame, but, I prefer a more practical solution)
     
  14. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi, nab477

    In your case, you can call SpriteRenderer.Apply to apply the changes of SpriteRenderer immediately.
    for example:

    //change some property
    spriteRenderer.depth = 10;

    //apply changes immediately
    spriteRenderer.Apply();
     
  15. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, Ostwind

    I check your video.
    I think your should be use right-click on rectangle above timeline to popup event menu to instead click menu from main menubar.
     
  16. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Ah great that was it! :)

    Works now. Thank you very much.
     
  17. nab477

    nab477

    Joined:
    Jun 14, 2011
    Posts:
    46
    it seems I reported this bug before, but it isn't fixed yet (using v0.452)

    in the hierarchy, if i parent a bunch of Sprite to a single parent, if i move the parent in Editor, they all move, if i move the parent while the game is running, they don't move !! (this problem does not exist with SpriteAnimation)

    I noticed that if i pause the game then select the Sprite in the Hierarchy, it will actually move with its parent

    Edit: it seems to move properly if I set the "Update Mode" to "Update"

    a few questions:
    1) can I check if an area has a bone ?
    (example: I attach a box collider on SpriteAnimation, but it's bigger than the body, when i click it, I want to check is the area empty or not (I want to attach an arrow to the body part that was hit)

    2) can I parent the arrow (in the example) to a certain bone ?
    (example: I attach an arrow to the Mummy's Head, when it dies, the game object is still straight, so the arrow is connected to the air, I want the arrow to move with the head bone, is that possible ?)
     
    Last edited: Jan 17, 2012
  18. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi,
    If you do not want call Apply manually or you do not know the parent transform changed, you can set the UpdateMode to a not None value. That will call the Apply in Update/LateUpdate/FixedUpdate automatically per-frame.

    A collider-base collision helper component will come in next release.
    It can be create a collider hierarchy, and move them when animation playing.
     
  19. nab477

    nab477

    Joined:
    Jun 14, 2011
    Posts:
    46
    thanks for the quick reply.

    so the problem with the sprite not following the parent is it need to call Apply.
    so using "Update Mode" is OK will not affect the performance, right ? (just confirming)

    the collider-base collision helper seems like a very interesting addition, looking forward to it.
    (although i hope I'll get the option to keep them as triggers)

    btw, the plugin is amazing
    it can also work with sprite based animations, which is essentially what the other plugins are made for !!
    (in each keyframe just keep the position change the sprite image)
    (my only current annoyance is that adding a sprite makes the pivot (top-left) by default, can i have an option to make (center) the default while importing sprites)

    Good work so far.
     
  20. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi,

    1.) The Apply method will have a little CPU cost, because it will re-calculate position, vecties, uv, color.
    So if you do not change the propertys of SpriteRenderer frequently, you can set UpdateMode to None, and call Apply manually when you need.

    2.) Yes, will add toggle in component inspector to select them as triggers/colliders.

    3.) I think I can add a menu command to help people set the pivots of sprite selection in SpriteAssetViewer.
     
  21. crystani

    crystani

    Joined:
    Jul 29, 2011
    Posts:
    68
    Hi, typehm

    I want to say big thanks for helping me so far.

    I've got a strange situation, however it is hard to define. I am using sprite mesh render and animation clips that are split into several animation clips by frames.

    What I am expecting is strange rendering for a few frames when Game Object that are containing sprite mesh render moves abruptly without using TIme.deltaTime on Update. For example, when a character reaches a certain position then the character is moved abruptly. In this case, first animation that are being rendered works strangely. If there is an animation is rendering, and its wrap mode is loop, maybe for the first few frames are rendered very strangely as if they are distorted and mirrored. After that first few frames, all animation works perfectly.

    I think that this is related with script execution order, while we can't control execution order of Update. (I was truly shocked after knowing that unity3d 3.4's script execution order setting has no effect on Start, Update. This is for Awake FYI.)

    It looks like something related with Easy Motion 2D's animation playback is on Update. For simple scenes, everything works fine. However, for the actual use case, I am suspecting that abrupt movement on Update of a monobehaviour results in strange rendering of animation for a moment.

    So as workarounds, I tried these two things. (These are only two examples that I tried during this week.)

    First attempt: setting sprite render's update mode as LateUpdate and turning off animation clip's automatic Apply. Failed. I think that the issue is not related with renderer, rather I guess this issue is related with animation.

    Second attempt: I forced Play animation clip after abrupt movement. I works well, however I think this is just a workaround and not the final solution.

    In short, I am seeing very strange animation rendering for the first loop (time to time after abrupt movement.)

    I am sorry for not defining the problem properly. Also, I know that it is very ambiguous situation to find out what is going on. However, It surely happens with very crowded and frame drops, so I think I have to let you know this issue even if it is very hard to reproduce for other cases. I hope you can get what is going on with my case with these just restricted information as you are the developer of this framework.

    Thanks,
     
  22. crystani

    crystani

    Joined:
    Jul 29, 2011
    Posts:
    68
    Hi, typehm

    Ignore the previous post that I wrote. After spending this whole week finding the reason why the strange rendering that I posted before happens, I could find what makes things look strange.

    1. I am using version 0.46, which is sent by you for the blinking issue.

    2. From time to time, especially when animation is played within very short period of time, or renderer is moved abruptly, animation is not rendered at all for a frame or so. I don't think this is the issue with 0.46, because it was there even with 0.452.

    In other words, sometimes animations are not rendered at all for a frame or so if animation renderer is asked to play animation clip within very short period of time. (As if animation is blinking.) After that few first frames, animation is somewhat Stabilized, then that kind of flickering issue is gone. I have tested this with wrap modes such as Default, pingpong, clamp forever... and with crossfade or play.

    This is not noticeably as issue 3. If I had not used override, I would have not even realize the problem.

    3. Currently I am using override sprite functionality. Therefore, whenever 2. happens, while nothing would be rendered if there is no animation playing, very strange shape of characters are rendered. However, this strange rendering is happened because of the issue 2 I guess.

    4. This is not necessarily related with this problem, but It looks like there is a bug with PlaywithQueue Method. I believe you can find what is going on, because whenever I use this method animation is rendered very slowly. (This might happen with animations that are generated by the method AddClip with 4 arguments.)

    Thanks.
     
  23. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, crystani

    I help a user to fixing a nest clip issue in these days.
    I will reply you later.
     
  24. Hujo

    Hujo

    Joined:
    Dec 6, 2011
    Posts:
    88
    i have to say that im really thrilled to see this release, for a while i've been thinking about making sprites and make them move like shadow dolls, sadly i really hated that i can't find it anywhere. but now i have found my answer.
    however i do have couple of questions.
    do we have to purchase EasyMotion2D with other 2d kit like ex2d? in order to make the collision work? i think i read in earlier posts that the collision/physics dont work on easymotion2d

    another question is , what about the draw calls? will your , if i decided to have like 5 - 10 sprites moving in the iphone screen, will it be slowed down?

    creating an FAQ section or showing a demo on its performance on iphone/android would really be cool

    thanks.
     
  25. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, Hujo

    Collision support will provide in next release(0.46).

    For the performance, you can get the beta release. It include two examples. You can build it to iphone/android for testing.
    In my test, EasyMotion2D can support 50 sprite with 16 bones(sub sprite) in iPod touch4 in 28-30 FPS.
    Beta Release


    I suggest you get the beta package to try the EasyMotion2D first. Because it workflow has a few difference with Unity3D now.
     
  26. ValenUA

    ValenUA

    Joined:
    Nov 14, 2010
    Posts:
    20
    Bot it several days ago :) Really like it so far, and it seems that it works great with pathfinding system SimplePath.
     
  27. Hujo

    Hujo

    Joined:
    Dec 6, 2011
    Posts:
    88
    thank you so much for the reply. i'll test it out .

    edit

    i tried it out, it keeps giving me 61 FPS , even if i put the count to even 5 sprites. but then again, maybe i have a crappy 4 years old pc >.>

    edit

    i think i was doing something else on my pc , maybe the update was running. now its staying still on 16-21 FPS with 50 sprites

    i think its wonderful :D i'll definitely get it once i finish the basic learning with unity

    thanks for making this wonderful tool :D
     
    Last edited: Jan 22, 2012
  28. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi,

    I think the reason of 61FPS is: With default quality, Untiy3D will waiting the Vertical Blanking, so If you use a common LCD monitor, the screen refresh rate will be 60hz. So you will get a fps nearly 60.

    I use a 3years old pc and a 2years old macbook. The example of 50 sprite can be running more than 250fps(do not waiting vertical blank) on my machine. Maybe you should check your system what's going on.
     
  29. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    I think this issue will happen when the animation updated and start playing a new clip. At this moment, if camera rendering the scene, the SpriteRenderer will use have no data or get some old dirty data for rendering. Because new datas will calculate in next Update call.

    I sent a new package to you, please help me to check is the issue gone? Because I can not get a way to reproduce the issue now.
     
  30. Hujo

    Hujo

    Joined:
    Dec 6, 2011
    Posts:
    88
    makes sense, thanks :D
     
  31. crystani

    crystani

    Joined:
    Jul 29, 2011
    Posts:
    68
    Hi typehm,

    Sadly, the issue is not solved with your new package. You have mentioned that the package is related with blinking issue, not the Update call execution order. So I guess that, as you said, the reason for the strange rendering issue is related with Update call that is not called in some circumstances before things are rendered.

    In other words, I have some routines that are called on Update, and in some case I believe that those methods' update calls are executed after SpriteRender/SpriteAnimation's Update calls. However, while I can control SpriteRender's execution order, Sprite Animation seems not have any option when I can play it lately(LateUpdate or FixedUpdate) or not.

    Otherwise, I think it would be the solution If I can call something that executed on Sprite Animation's Update from outside... though that is not a good idea to reveal that kind of internal logic.
     
  32. ValenUA

    ValenUA

    Joined:
    Nov 14, 2010
    Posts:
    20
    Hello again, I have a new question from our programmer. Currently it seems that when we change your depth parameter it actually changing position by Z axis but there is no backward effect, changing Z axis position of the object(character for example) doesn't change depth parameter. Is it possible to make some adjustments in the next version of the EasyMotion 2D, so movement by unity Z axis will effect your depth parameter so we will be able to sort by unity transform.position. Tnx in advance.
     
  33. ValenUA

    ValenUA

    Joined:
    Nov 14, 2010
    Posts:
    20
    Sorry for double post but I have encountered some major problem or may be a bug. I have created animated character in animation editor, and made idle animation for him. I put him to scene (EasyMotion2D->GameObject->SpriteAnimation) and there assigned idle animation to clip field of SpriteAnimation object, like in video tutorial :) I also put 2D camera to the scene (EasyMotion2D->GameObject->Camera2D). But when I start my game my character looks completely wrong, all parts from witch it consists are put to zero by xy axises, so it looks like really wrongly teleported pig creature from last star track film :))) But it still looks alright in the animation editor.
    I haven't encountered that problem with 3.9 beta. And I created my character from scratch in 4.5.2. Dose anybody encountered that problem in there projects? Please help.
     
    Last edited: Jan 26, 2012
  34. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, I think maybe your clip have some component with same name in same hierachry level. If in this case, you can chanage the component name to difference.
     
  35. ValenUA

    ValenUA

    Joined:
    Nov 14, 2010
    Posts:
    20
    Yeah, you were right, stupid me :) All my components were called "component", because I couldn't find how to rename them, I tried right clicking on them, double clicking etc. and thought that maybe they couldn't be renamed, and only now I looked at the bottom of the layers of the animation timeline and found a text field there with the name of the bone :)
    Anyway, now after renaming, everything works fine, thank you very much :)

    Also what about depth parameter for Animation Sprites and is possible to change it by changing unity Z axis coordinate?
     
    Last edited: Jan 26, 2012
  36. crystani

    crystani

    Joined:
    Jul 29, 2011
    Posts:
    68
    Hi typehm,

    I was correct. I mean, the reason why the strange rendering happened was bad script execution order. I used the method UpdateInternal of sprite animation, which is luckily publicly accessible, whenever the animation is changed. (Played) And the artifact is gone completely.

    I don't think this is not the issue that is limited to my case. This happens whenever animation is changed. In my case, however, it was much noticeable than any other cases because:

    1. I am using override feature, so when animation execution order is messed up, the strange rendering is much noticeable.
    2. My game scene is complex, and there are lots of scripts that are executed on Update. Therefore, some scripts are executed after Animation's update (Almost always with my game.)

    I know that this issue is might be negligible when override sprite is not used. However, even for the cases where override sprite is not used, I saw somewhat blinking rendering between animations' transition even if it is not really visible for everybody. (And this blinking happens even with older versions.)
     
  37. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi,

    Z axis apply to z was implmented.
    But have some limit:
    If calculate depth from z axis to depth out of depth value range, will adjust gameobject layer and SpriteRenderer depth.
     
  38. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi, crystani

    Thank you for the feedback.

    I think I can add a UpdateMode feature like the SpriteRenderer, also expose the update method.
    With this change, I think user can be control script execute order by manually when need.
     
  39. crystani

    crystani

    Joined:
    Jul 29, 2011
    Posts:
    68
    I think that, beside the update mode, calling UpdateInternal(0f) internally whenever animation is Played (or new animation clip is required to initiate playback) is the solution for the issue I have mentioned so far.
     
    Last edited: Jan 27, 2012
  40. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Few questions:

    - is there a hotkey to rotate component with keys in animation like you can move them with arrows? like shift + left/right to rotate back and forth?
    - is there a way to play animation reversed?
    - is there a way or a hotkey to copy/paste position + rotation from component to other but keep other settings?

    edit: are colliders coming soon? i need to detect hit to head and its not easy at the moment, would have to use mix of frametime and coordinates in different animations to detect it

    So far very good package and recommend it to everyone :)
     
    Last edited: Jan 27, 2012
  41. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi, Ostwind

    1.) Hotkey to rotate current component will add on next release.
    2.) You can set the speed of SpriteAnimationState to a negative value to play animation reverse.
    3.) Will add this feature in next release.
    4.) Colliders include in next release, I think it can be release in next week.
     
  42. yadoa

    yadoa

    Joined:
    Oct 24, 2011
    Posts:
    13
    There are some problems with BitmapFontTextRenderer.
    First, I want to dynamically change anchor of BitmapFontTextRenderer.
    Second, created a bitmap font using AngelCode bitmap font genitor.
    But does not apply. The text is not displayed.
    ArialBlack48 contained in the sample is a normal operation.
    Follow the steps as shown in this tutorial, but does not work.
    (http://em2d.soft-hm.com/wiki/doku.php?id=bitmapfont)
    I will attach a bitmap font.
    View attachment $arial_yadoa.fnt.zip
     
  43. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, yadoa

    Your attachment will not include image files. It will can not import.
    You should keep the fnt file and image file in same folder before iimport.
     
  44. laputa5

    laputa5

    Joined:
    Nov 29, 2011
    Posts:
    3
    Hi, typehm
    I'm playing with the '2D Platform' demo in version 0.452. I noticed that sometimes the warrior finished an attack, it snaps back to the original position before the attack animation happens, even with the RegisterMoveHandler() in WarriorController.cs called. Is this a bug in the runtime? or a bug in the demo?
    Thx.
     
  45. yadoa

    yadoa

    Joined:
    Oct 24, 2011
    Posts:
    13
    Sorry, I was missing one file by mistake.
    I generated without any settings files in BMFont program. It did not work.
    but play project with set to the font that work, and stop, and assign the new font. it work well. ^^?;;
    Anyway, It seem be work well.

    And should I access TextAnchor and TextAlignment of BitmapFontTextRenderer??
     
  46. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, laputa5

    I think it's bug of the demo. The reason is use a position in a new clip to subtract a position in old clip, will get a large offset.
    I will fix this issue later.
     
  47. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi, yadoa

    BitmapFontTextRenderer do not support TextAlignment now. It only support align text in left-top now.
    After 0.46 released, I will try to add TextAnchor and TextAlignment to the BitmapFontTextRenderer.
     
  48. laputa5

    laputa5

    Joined:
    Nov 29, 2011
    Posts:
    3
    Hi, actually I think it's the same clip. Just when a playing clip with WrapMode=Once passes the end, the position will be zero, which causes the large offset. Setting the WrapMode to ClampForever or make sure the clip doesn't get played passed the end seem to fix the problem.
     
  49. yadoa

    yadoa

    Joined:
    Oct 24, 2011
    Posts:
    13
    Hi, I request again.
    Bitmap font is work well.
    But one thing, does not apply carriage return of Text of BitmapFontTextRenderer.
    1. How can I change line? Rather than using a text area, work as attach the '\n' at end of a sentence.
    "example,
    I hope in this way.
    This is one of the string."
    2. Anchor property of SpriteRenderer can be changed at runtime?
    3. And I hope 'utility> texture group importer' would be change 'texture type' at a time too.
     
    Last edited: Jan 31, 2012
  50. ValenUA

    ValenUA

    Joined:
    Nov 14, 2010
    Posts:
    20
    Aha I see. But is it possible to create some option that when activated depth parameter will be fully ignored and native movement by native Z axis parameter will be active as to any other non EasyMotion object in viewport. So I could just move object by Z axis using move gizmo in editor.
    If not is it possible to create some demo level where character will move not only by X and Y but also will change depth, like in IOS Trenches or BattleHeart games.
    Tnx in advance. :)