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
    If you do collision like this in function OnAttackcollisionDetect in WarriorController.js.

    Code (csharp):
    1.         //do a raycast to find does any object was hit?
    2.         var hits: RaycastHit[];
    3.         hits = Physics.RaycastAll( atkHit.startPos, dir, dis );
    4.         Debug.DrawLine( atkHit.startPos, currPos);
    5.  
    6.  
    7.         for( var hit : RaycastHit in hits)
    8.         {
    9.             // a object with a rigidbody
    10.             if ( hit.rigidbody != null )   
    11.                 AttackToCube( hit.transform.gameObject, fwd );
    12.  
    13.             // not me
    14.             else if ( hit.transform != transform )
    15.                 AttackToEnemy( hit.transform.gameObject );
    16.         }
    just modify it to:

    Code (csharp):
    1.  
    2.         //do a raycast to find does any object was hit?
    3.         var hits: RaycastHit[];
    4.         hits = Physics.RaycastAll( atkHit.startPos, dir, dis );
    5.         Debug.DrawLine( atkHit.startPos, currPos);
    6.  
    7.  
    8.         for( var hit : RaycastHit in hits)
    9.         {
    10.             // a object with a rigidbody
    11.             if ( hit.rigidbody != null )   
    12.                 AttackToCube( hit.transform.gameObject, fwd );
    13.  
    14.             // not me
    15.             else if ( hit.transform != transform )
    16.                         {
    17.                 AttackToEnemy( hit.transform.gameObject );
    18.                                 break;
    19.                         }
    20.         }
    it will hit the nearest object only.
     
  2. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    Very good.
    Thank you again.
     
  3. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    How to identify the depth SpriteRender.

    function start ()
    {

    Depth = GetComponent(EasyMotion2D.SpriteRenderer.............

    }

    I've tried several ways and failed.
     
  4. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    I just found a solution.

    THANKS!!!!!!!
     
  5. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    EasyMotion2D v0.43 released on Asset Store.
     
  6. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    If you use Undo/Redo to rollback a operation with component hierarchy in AnimationClipEditor. It maybe make clip data lost.

    I will stop all other works to fix this issue as soon as possible. When it fixed, I will release a update to Asset Store.

    For now, please be careful it.
     
  7. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    When I try to use the Tile Map Editor appears this message.

    Camera Scene air must look in XY plane

    I've tried to use everything. What should I do?
     
  8. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi, BrainFx

    You should set your scene camera like this in Scene View.

    $camera.jpg
     
  9. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    Are you kidding. That's it.

    Thanks!!!!!
     
  10. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    hi! we just got this and it looks awesome! any plans to add swf import or something similar?

    All our animation is in afterEffects- we (my company) is willing to write an exporter to this format (and share it, of course) if you can provide details/information about your animation format.
     
    Last edited: Nov 28, 2011
  11. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, yuriythebest.
    I think a importer for SWF is pretty sweet.
    But now the runtime of EasyMotion2D can not fully support a complex animation such like a Flash SWF.
    When the runtime of EasyMotion2D become more powerful and stable, I will try to do this.


    btw: I was planed to implement a JSON/XML animation clip file importer/exporter. I think it can be a back-end for the SWF importer.
     
  12. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    typehm, could Rage Splines be used in place of textures?

    iByte
     
  13. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, iByte.

    If you just want use a animated character work with Rage Splines, I think it's ok.
    But if you want use EasyMotion2D animation'data to make the Rage Splines objects animated, I think it can not now.
     
  14. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    yes! this would be perfect! How soon could that be done?
     
  15. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    Right something else- I'm trying to get my game to zoom in/out, and this requires that I change the orthographic size. however, when I select the "stretchFit" mode in Camera2d and change the size, it scales the height but not the width. that is a bug right?
     
  16. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    I will desgin the JSON/XML format soon.

    I will modify to set width of camera2d with the current aspect when you set the orthographic size in next version.
     
  17. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    noticed something else- when making an atlas and "Set Width/Height same is off", then if, for example the width is 256 and height is 128 in the atlas, the texture will still be 256x256, and the texture coordinates will be wrong for the atlas texture images
     
  18. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    In your case, I think you can try to set the padding to zero.
    Hope helpful.
     
  19. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    Thanks! I will try that. new question (sorry for the many questions)
    Our team exports to many devices (iphone, ipad,etc) and this requires multiple atlasses of different resolutions- will it be possible to have a single animation and switch atlasses?
     
  20. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    I think can not do that now.
    In my way, I use different camera viewport in view the same world in different resolutions.

    This question is interesting. I will think how to do that.
     
  21. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    in toolkit2d what I did was, I had several atlasses and wrote a script to switch between them.Each toolkit 2d atlas had a target resoltion setting so the sprites would scale accordingly.

    EDIT: setting padding to zero on the atlas didn't help- I've attached a screenshot- look at the wheels at the right and compare with the image (in the texture selection)- they are stretched vertically and only the top half is seen, probably because the UV coordinates still behave like the map is same height/width even though it's not
     

    Attached Files:

    Last edited: Nov 29, 2011
  22. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Thank you for your tips. I have some idea now. Will try to do this after 0.45 released.
     
  23. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    thank you! you reply very quickly indeed. this plugin has a lot of potential
     
  24. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,125
    Right noticed something else- I like to arrange my windows (not just open and close the easymotion stuff but dock it)- however when I open and close unity3d they always write "failed to load asset" and I have to close them, re open them and re dock them.
    Edit: this seems to happen when I switch between projects

    (tell me if I should continue reporting stuff or if this is annoying you :) )
     
    Last edited: Nov 30, 2011
  25. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi,
    Could you give me this atlas to show the issue?
    You can select the atlas and use "Select Dependencies" command get all the dependencies in Project Window, and export atlas and its dependencies into a package.
    You can send the package in mail to my mail box: typehm@foxmail.com.



    Because the edtior window require the editor sciprt in EasyMotion2D. When you switch between projects, the window can not get the editor script anymore, so it will "failed to load asset".
    I think in this case, I can not give any help.
     
  26. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    EasyMotion2D v0.44 is available on Asset Store now.

    Fix the fatal issue of SpriteAnimationClip with deep nested animation component hierachy level.
    EasyMotion2D v0.44 will upgrade all exists SpriteAnimationClips to new data format. Pelease backup you solution before upgrade to v0.44.
    If you have any trouble in clip upgrade, please contact me: typehm@foxmail.com.
     
  27. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    typehm, do you have any docs on how to use the BehaviourController's?

    iByte
     
  28. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Thanks for your efforts, I hope that EasyMotion2D becomes as stable as possible ;)

    Cheers,

    [edit]
    Oh, is this possible to attach a prob to a character? (his hand for example)

    I don't see the hierarchy in Unity inspector, I wonder if it will be available in future updates or not? Shall I post a feature request in your website as well?
     
    Last edited: Dec 1, 2011
  29. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi,
    I have no document of it. Becasuse it very simple, so I does not write a document for it.
    I think I can make a video tutorial to show people how to use it.



    Hi, this is a goal of current working versions. It will come out in v0.45.
     
  30. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    Great ;)

    I have another question though:
    How can I have different atlas sizes for different platforms for example, PC and Android?
    If I resize the the atlas texture the animated character will lose everything! I guess the atlas splitter does not use UVs that are numbers between 0-1 that will actually work with any size of textures, right?!

    [edit]
    Oh, and can you please update the what's new section here?
    http://em2d.soft-hm.com/wiki/doku.php?id=what_s_new

    Thanks
     
    Last edited: Dec 1, 2011
  31. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi,
    Atlas and Sprite store the original size and position of texture and use it to calculate UV in runtime. So it can not resize the altas now.

    I will update the what new page.
     
  32. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    typehm,

    can animation clip be made to work on sprite GameObject in addition to sprite asset? or Is Sprite GameObject just for static display?
    I hope the question makes sense?

    iByte
     
  33. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi typehm,

    Been working with your EasyMotion2D package and liking it ... Thanks!!

    Here are some issues and wishes of your consideration.

    Issues


    1. When pressing play in editor it hides that background texture. Can it be optional to leave the texture showing? Would be handy when testing animations.
    2. When selecting different components in the animation canvas does not always refresh the data in the floating dialog box position/rotation fields.
    3. Why does the animation always play when a sprite is selected in the hierarchy view if it has an animation attached to it? This is in edit mode not play mode?
    4. Edit source textures to make edits (change size/shape) , reimport textures but sprite.assets sizes not updated?
    5. Parent SpriteAnimation under another game object can't reset x/y to zero as normally done when nesting gameObjects?


    WishList

    1. Would be nice to have some grid snapping/alignment tools for easier object placement.
    2. Ability to zoom in closer to objects in animation canvas.
    3. Allow the use of arrow keys for while selection active in timeline movement.
    4. Allow the use of arrow keys for object movement (if object selected) in animation canvas
    5. Use a Modifier key when selecting keyframes to distinguish between select vs drag drop.
    6. Copy all selected keyframes. Some times this works via drag/drop ... sometimes not.. no menu item for this.

    Thank You

    iByte
     
  34. typehm

    typehm

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

    A Sprite just a reousrce asset, it need a SpriteRenderer component to commit to rendering, a SpriteAnimation component apply the animation information to the SpriteRenderer make sprites animated.



    Issue:
    1.) I will add a option the enable this.
    2.) Yes, if the text filed in dialog get the key foucs, this issue will happen, just press Enter to make the field leave foucs can solve this.
    3.) Yes, this is a feature to preview animation in edit mode, I will add a toggle in SpriteAnimation to switch this.
    4.) This feature now support yet, you can drag the source textures to origin sprite, and re-layout re-build the atlas for now.
    5.) I don't very understand what your mean, would you give more details? Such as a example?

    WishList:
    1.) After finish the working of runtime, I will move my working target to the editor.
    2.) Did you means zoom the animation in animation canvas? You can use Shift+Mouse scroll wheel to zoom it.
    3.) Use Mouse scroll wheel in animation canvas can move th active in timeline.
    4.) Yes, you can use arrow keys to move the selected object in animation canvas.
    5.) I don't very understand about this, would you talk more details?
    6.) You can make a block selection in timeline, and Hold Ctrl(windows)/Command(OSX)+drag to move them, or just drag to move them.

    I am very glad you like the EasyMotion2D. I will keep working to made it better.
    Thank you.
     
  35. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
  36. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    These features are great, awesome :D
    Can't wait for more :D

    Oh, I think I found 2 little bugs,
    1- Mirror (Scale, X = -1) a parent item in the hierarchy, its children won't be positioned accordingly!
    2- In a cutout character structure, I have a 'forearm' that has a 'hand' as its child, if I mirror the hand using scale it will show a different position in the Unity Editor than yours!

    How do you X scale a character so that it faces the right/left direction correctly? I have seen this in your demo scenes

    Thanks
     
  37. typehm

    typehm

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

    The Sprite Transform's behaviour same as Transform component in Unity3D.
    In your case, I recommand you do not use a Mirror in animation component with children. If you use it, the result will ugly, but this behaviour same as Transform component.

    If you want to use scale to change character faces, use gameObject.transform.localScele to do it.
     
  38. Curious

    Curious

    Joined:
    Nov 19, 2009
    Posts:
    334
    @typehm,
    I have another, very important question for you buddy ;)
    Is it actually safe to starting creating games using this library considering the fact that it is still in early stages of development?

    I've started mine so I wonder if it is completely safe to continue the journey or not?!

    btw, I really like EasyMotion2D, I'm gonna write a review as soon as I get more familiar with it :)

    Cheers,
    Curious
     
  39. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161

    Hi, Curious,

    I am agree EasyMotion2D is early stages of development now.
    So, in my suggestion, I recommand you try to use the EasyMotion2D make a prototype for your games at first.
    In fact, there is some customer of EasyMotion2d use it to start solution already. I trace their feedback to help them solve the problems with EasyMotion2D and keep EasyMotion2D going.

    I very glad you can enjoy the EasyMotion2D.
    Thank you.

    If have any questions, just post here or contact me: typehm@foxmail.com.
     
  40. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Okay will make separate post to describe this issue.

    Thanks!! That helps.

    Okay that helps with selection vs drag/drop. Could it be possible to have copy selected frames or did I miss that too? :)

    Great job ... keep it up ... Thanks

    iByte
     
  41. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Sorry, I mean hold ctrl/command + drag selection is copy, drag the selection directly is move them.
     
  42. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi typehm,

    Back to wishlist #5 - how do you distinguish a selection vs a drag initiation when clicking on an existing keyframe in the time line window?

    I find sometime it starts a drag and sometimes it starts a selection highlight 50/50? my suggestion was to use a key modifier so it will be a selection with key modifier or drag without. Select vs Drag (Like Copy vs Move)

    Thanks

    iByte
     
  43. typehm

    typehm

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

    In this case, if you click a timeline cell with a keyframe, then will start drag it, if you click a timeline cell not have a keyframe, then will start selection.
     
  44. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    That's all I expected. I'll try.
    I want to make my character run and shoot at the same time. I have the two animations. Where do I begin?
    It would be nice to have a video tutorial.
    THANKS!!!!!!

     
    Last edited: Dec 5, 2011
  45. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi, BrainFx
    These demos are show the new feature in next version, it not released now.

    You can use exist clip to do the blending and mixing.
    But it must base on the the same bone structure in each clips.
    Also, you can blending or mixing the clips have some different, but the main trunk structure must be same. If not, the result maybe can not be what you want.

    I will provide a some tutorials to show how to use the blending and mixing in next version.
     
  46. PepperGameplay

    PepperGameplay

    Joined:
    Oct 21, 2011
    Posts:
    36
    My project is stopped. These functions will be waiting anxiously.
    THANKS!!!
     
  47. InterstellarGames

    InterstellarGames

    Joined:
    Jul 5, 2011
    Posts:
    17
    typehm, would you please consider responding to my PM regarding the other 2D alternatives? Just want to make sure your kit is the best for animating and controlling characters. Thanks!
     
  48. yadoa

    yadoa

    Joined:
    Oct 24, 2011
    Posts:
    13
    There are a few questions.

    Using the animation editor to create animations,
    Using the same animation and the animation of a specific layer can be replaced?
    For example,
    In character animation, I do not know how to replace weapons.
    I've tried to duplicate the animations, assets, images and atlas,
    but duplicated Animation reference the previous atlas.

    And while using version 0.42
    Update to version 0.44, but the problem occurred.
    sprite appears on the problem, that using RenderModeSetting with Easy2D.Additive.
    In previous versions of a texture with transparent areas, did not appear,
    After updating the transparent areas appear black.
    We need to work again and the whole image,
    I would like to know so that alterations be kept compatible.

    When using a BitmapFontTextRenderer,
    does not seem to outline the options.
    I would like to remove the outline I do not know how.
    or if there are other ways to express the text, I want to know how to use.

    One more thing.
    does not close the tile editor menu appears in scene pannel.
    I pressed the close editor button, but not responding.

    And I expect to come out quickly, animation mixing.

    Thanks.
     
    Last edited: Dec 6, 2011
  49. typehm

    typehm

    Joined:
    Jun 24, 2011
    Posts:
    161
    Hi,

    If you need replace weapons in game running, you should play the clip, and use SpriteRenderer.GetSpriteTransform to get a SpriteTransform reference to the bone, and assgin a sprite to the overrideSprite of SpriteTransform.

    If you need want to replace the weapons in another clip, you can duplicate the source clip in project window, and re-assgin the weapon sprite to the animation component in new clip by clip editor.


    If you have a backup for you project, could you give me a example to reproduce this issue?


    The text font is import a external bmfont file. It can be create by AngelCode bitmap font geneator(windows) or Hiero bitmap font geneator(OSX).

    You should use these tools to create the font what you wanted, and import it with EasyMotinon2D by use the "import bitmap font file" menu item in project window.


    I will modify it to make it can be really closed.
     
  50. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Hi typehm,

    I have edited this question. How to adjust the z depth of the sprite animation?

    Also SpriteSceneRender seems to be automatic parent of any animated sprites?

    iByte
     
    Last edited: Dec 7, 2011