Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Smooth Moves - 2D Skeletal Animation

Discussion in 'Assets and Asset Store' started by echo17, Feb 20, 2012.

  1. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Totally awesome! Thanks so much for sharing. Do you mind if I add this to my first post on this forum?

    FYI, this is a great example of how you can do skeletal animation, sprite animation, or a combination of the two. Thanks!
     
  2. kdbguy

    kdbguy

    Joined:
    Aug 29, 2011
    Posts:
    16
    No problem. I'll make a better version later but you can use this for now.
     
  3. SpadeAce

    SpadeAce

    Joined:
    Mar 12, 2012
    Posts:
    7
    Hello,

    When i add images from different folders to an atlas, atlas editor crashes. Could you please help me?


    Error Details:
    ArgumentException: key already present in dictionary
    Parameter name: key
    System.Collections.Generic.SortedDictionary`2[System.String,System.Int32].Add (System.String key, Int32 value)
    SmoothMoves.TextureAtlasEditorWindow.Redisplay ()
    SmoothMoves.TextureAtlasEditorWindow.CreateGUI ()
    SmoothMoves.TextureAtlasEditorWindow.OnGUI ()
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
    UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/BuildAgent/work/b0bcff80449a48aa/Editor/Mono/GUI/DockArea.cs:228)
    UnityEditor.HostView.Invoke (System.String methodName) (at C:/BuildAgent/work/b0bcff80449a48aa/Editor/Mono/GUI/DockArea.cs:221)
    UnityEditor.HostView.OnGUI () (at C:/BuildAgent/work/b0bcff80449a48aa/Editor/Mono/GUI/DockArea.cs:121)
     
  4. AntFitch

    AntFitch

    Joined:
    Jan 31, 2012
    Posts:
    243
    Hey echo17, have you thought about posting your playMaker actions on the playMaker forums? I see ones for other programs, but not yours. I didn't know about your playMaker actions until I accidentally stumbled across them.
    http://hutonggames.com/playmakerforum/index.php?board=19.0

    [kontrabida: Rival Threads looks great!]
     
  5. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    It looks like it is crashing due to two or more textures having the same name. It is trying to sort them alphabetically and sees that a texture with a particular name already exists. I'll put a fix in the next release to allow the same name, but until then, you can just make your texture names unique to work with the atlas editor.
     
  6. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Good idea! I haven't been on those forums, so I'll have to check it out. Thanks!
     
  7. SpadeAce

    SpadeAce

    Joined:
    Mar 12, 2012
    Posts:
    7
    It worked. Thank you for your help.
     
  8. kdbguy

    kdbguy

    Joined:
    Aug 29, 2011
    Posts:
    16
    Thanks! :)
     
  9. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    The Plugin looks terrific. But I have a quick question.

    I notice in the tut videos, you make a separate atlas for the Knight and his weapons. Could these items have been combined into a single Atlas? Seems like a fair amount of wasted space in the Knight's atlas.

    One of the first things that attracted me to TDTK was it's handling of Sprite Atlases. I love how it slices and compresses elements to really get the most out of each Sprite Atlas. Is this something you imagine adding in the future? Or even texture rotation so individual sprites can be packed in efficiently? On the other hand, your ability ti swap out textures on sprites is why I will need to purchase your tool set. Damn I wish you guys would all get together and make an Uber Solution...would save me buying multiple plugins!

    Keep up the great work.
    B.
     
  10. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    @brendang - I can answer this. Yeah - he could easily have combined the two into one atlas- i suspect this sample is demonstrating how you might handle a game with many more weapons and outfits than might fit in a single atlas.

    The limit, predictably is simply atlas size, so 2048x2048 on mobile, bigger elsewhere. The atlases are built automatically, and frankly it works really easily and well. I have an animated bird, for which I had 4 different eye textures, and have had great fun animating him - video coming soon. Being able to key scale means I have also been able to flip horizontal/vertical certain textures (like eyes) for easy additional variations, (as well as rotation and size etc).

    I've said it elsewhere before, but so far this is by far my favourite purchase off the asset store in terms of ease of use and sheer versatility.
     
  11. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    In fact being able to change texture atlases, textures, size, rotation, easily pivot and have an extremely friendly animation editor makes this by far the easiest animation tool I've yet to use.
     
  12. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    @RunontheSpot Appreciate the confirmation. Yeah, this looks terrific. I just bought the other package 2 weeks ago for our current project, but with a character heavy 2 animated game, Smooth Moves seems like a no-brainer. I was gonna do the set up and animation in Maya then import. I'm sure I'll make use of each package for their strengths.
     
  13. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    261
    Quick problem / question: Just trying to figure out how the file structure of Smooth Moves works.

    If I create my Smooth Moves assets on my Mac, then try to move them to my PC and into a different scene, nothing works right. Atlases are completely empty and the positioning of objects in an animation is messed up. Does the atlas file itself not contain all the atlas data? Doesn't make sense that one should have to rebuild atlases and animations every time the asset is used in a different context...

    Thanks!
     
  14. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Thanks, runonthespot. You are correct. The tutorials show how you can use multiple atlases in a single animation, but I could have just as easily combined the weapons and knight into a single atlas for better optimization. In the case of the knight, it is quite a bit of an improvement, since my texture ordering causes the mesh to create three draw calls. With a combined atlas, you'd only have a single draw call.
     
  15. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Thanks, brendang. I might revisit beefing up atlas functionality in the future, but right now I want to focus more on the editor. There is enough there to keep me busy for quite a while.
     
  16. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Hi dasbin.

    Be sure you are moving your projects by exporting / importing them as Unity packages. Unity's package format keeps the links between your atlases, textures, and animations intact, so that is the only way to move around your work. Hope this helps!
     
  17. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Smooth Moves 1.7.2 is now available!

    Overview of features:
    - Added default pivot to the atlas editor. Now you can set your pivots once and then use the defaults in the animation editor. You can also override the default as well.
    - Warning icons for bone properties that require at least two keys to generate an animation curve.
    - Various cosmetic changes and bug fixes, full list in the readme file.

    Head on over to the asset store to pick up the update!
     
  18. bananamouth

    bananamouth

    Joined:
    Apr 10, 2012
    Posts:
    6
    Hey Echo, one quick question: If I create a bone hierarchy and animations with a select group of textures, can I alter the textures without ruining the animations? I ask since I would like to create a mock up version of the character and use it to prototype the game, and then worry about it's looks and refine the animations. The more effortless it is the better.


    Thanks!
     
  19. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    I imagine this would be possible. The only thing that I could see that would require more work is if your original mockup textures were of a different size than your final textures. Smooth Moves will compensate automatically for this, but your positioning and pivots may be off and would need adjusting on each keyframe that these properties are set. So the amount of effort in this case would be proportional to the number of keys set for the positions and pivots.

    Hope this answers your question!
     
  20. bananamouth

    bananamouth

    Joined:
    Apr 10, 2012
    Posts:
    6
    Say, assuming that I create my new texture with its components having a similar position and size to my previous one, I would have to eventually make adjustments to the joints placement and rotation instead of recreating the whole animation setup and animation keyframes? Kinda like re-targeting an animated rig to a new mesh.
     
  21. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    That sounds about right. I did leave out the critical step of you having to switch the atlas and texture keys as well. If you set these up on frame zero, then it shouldn't be too much work unless you are switching out your textures a lot through the animation.
     
  22. bananamouth

    bananamouth

    Joined:
    Apr 10, 2012
    Posts:
    6
    Great. Thanks for the answers!
     
  23. undream

    undream

    Joined:
    Dec 24, 2011
    Posts:
    27
    Hello Echo17
    Thank you for this great tool, I recently had the chance to try it out to see if it'll work with my current pipeline, and it seems absolutely great for my case.

    However, there is one very simple issue which is bothering me. That is the draw calls.

    When I create a new bone animation and create it useing only one textyure atlas, it creates only 1 draw call.
    However, when I duplicate the very same game object (with the bone animation) it adds one additional draw call. What can be the cause of this problem ?

    I would love to know if there is a possible solution to this problem,

    Cheers.
     
  24. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Actually, this isn't a problem with Smooth Moves, but a limitation in Unity's design. Unity will not batch skinned meshes, even if they share materials. Here's some threads that touch on this point if you are interested:

    http://answers.unity3d.com/questions/53276/how-to-get-batch-working-for-multiple-on-screen-ch.html
    http://answers.unity3d.com/questions/31818/draw-call-count-not-consistent-in-prefab-vs-model.html
    http://forum.unity3d.com/threads/114512-Skinned-Meshes-vs-Animating-transforms-and-batching

    [EDIT] I'm not a Unity engineer, but I imagine that skinned meshes are not batched because the overhead of copying the transformed vertices every frame would actually be more of a detriment than a performance boost. That's just a guess however, so I'll let the experts comment on that.

    Check out the first post in this thread and you'll see that my 30 knights test is performing over 90 draw calls per frame, yet it still runs smoothly on an iPad 1. I'm not sure at what point you will notice a slow down, but unless you are developing for old devices, you have quite a bit of draw calls to play with.
    [/EDIT]
     
    Last edited: Apr 11, 2012
  25. undream

    undream

    Joined:
    Dec 24, 2011
    Posts:
    27
    Thank you for the quick reply.

    I used to do my character animations for my plane(only)-based-characters within my 3d application, without using bones (only position rotation and scale) and when I import my characters without the need of bones I could simply call the animations, which means, I could simply do the batching (no skinned mesh renderer).

    Is there any such way to create the animations with this tool without using skinned mesh renderer but regular mesh renderer ? I strongly do think that may help with a lot of cases since most of the position rotation and scale based animations don't even need bones to work..
     
  26. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    I had toyed with making my own format for Smooth Moves, but in the end decided that using a skinned mesh would be the best for a couple of reasons. A skinned mesh keeps a consistent workflow for those that are familiar with importing an FBX file from a third party tool such as Maya, Blender, or 3DS Max. Skinned meshes are native to Unity, so all their functionality will be optimized at a very low level (meaning faster and better performance).

    Smooth Moves is primarily a skeletal animation system, designed for use in characters consisting of a number of bones transforming a mesh. It just happens to be good at sprite animation as well, if you are comfortable with the loss of batching.
     
  27. undream

    undream

    Joined:
    Dec 24, 2011
    Posts:
    27
    I see your point about the format. However, I use FBX format as well, that's actually how I transfer everything to unity3d (including position-scale-rotation animations). I believe there should be a way to keep everything batched without using anything else, and I believe it would be perfect for this awesome tool.

    Thank you for the replies.
     
  28. Evil_Toaster

    Evil_Toaster

    Joined:
    Apr 12, 2012
    Posts:
    10
    Howdy. First up I'd just like to say SmoothMoves is awesome. I've been wanting something to easily do 2D skeletal animation in for ages, I dabbled with making one in ActionScript a while back, but it was pretty crap in comparison. So, thank you for making it. :)

    I'm busy working on a runner game involving a banana that everything wants to eat, and I'd like to put forward a list of things I'd personally like to see added to SmoothMoves based on what I've been trying to do so far.

    SmoothMoves Wishlist

    Animation Set Scaling: For multi-device development, it'd be great if one was able to scale an animation set down so lower res graphics can be used, perhaps via having a way to switch out a lower res atlas and give a % to scale down the position movement values by.

    CrossFade on finish animations: CrossFade doesn't work if the previous animation has finished, it just snaps to the new animation. Is there perhaps another function available that would smooth into the new animation?

    Polygon colliders: Neither a sphere or a box works very well on a banana, and there's also going to be a variety of plants, which I doubt are going to fit too well either. From what I gather, a mesh collider can be used for this purpose, but making the mesh would require using a 3D package, and ensuring that it's sized correctly relative to unity's world space measurements. If smooth moves could provide a built in editor for this, that'd be awesome. Probably the best way would be to have it directly create mesh assets which could be used within SmoothMoves, or elsewhere. (I'll be using ex2D for some of the other game elements, like text, static sprites, UI elements, and it'd be useful to be able to use polygon meshes there too) 2D Toolkit is the only package I'm aware of which allows one to define polygon colliders, where you can 'trace' around the image and end up with a polygon roughly resembling the graphic. (Sadly, I don't own it, so I can't say if it creates meshes I can use with SmoothMoves)

    Collider Angles: Something that would also really help is to be able to set a relative rotation on the collider. The sprite isn't necessarily always aligned with the X or Y axis.

    Child bones position affected by paren't scale: Is it possible to add an option where scaling affects the child bone's X/Y? I.e. Their positional offset takes into account scaling) I was trying to make a leg animation where the leg was not only moving on the X/Y axis, and I was trying to simulate Z movement by scaling the sprite vertically. (Consider a character with bandy legs angled out at say, 30 degrees)

    Export Animation Frames: The ability to export an animation to a series of image files. Being able to generate static sprites would be very helpful to quickly generate animations for things where one doesn't necessarily want all the functionality at runtime. Lets say example, say I wanted a flock of 50 birds flying past. For each of those to be a SmoothMoves animation would be pretty big waste of processing time.

    Bugs
    - I had a case where I had a "Stand" and a "Run" animation. Playing "Run" on the character's Start() method worked, but any attempts to set it during Update() would not work, and no error came out in the console. This bevaiour only stopped after I added a third animation. Very strange...

    - In another case, I had a character with a body, and a face attached to it. I needed to replace the body with a more 'upright' version in order to get a box collider to fit better. I did so, which then caused the face to move to completely the wrong position. I then moved it back in on the various animations, and all looked fine in the editor. When previewing in unity, the face went back to being totally disconnected. I fixed it by creating new animations using the first frames, and then copying the other key frames in. Seems something didn't recalculate internally?

    SmoothMoves version at the time was 1.5.0, Unity version is 3.5.0.

    Unfortunately, for both of those cases, there isn't really anything I can send you, as I've been adding to / working on the character since then. Perhaps just keep an eye out for that sort of thing happening.
     
    Last edited: Apr 12, 2012
  29. Evil_Toaster

    Evil_Toaster

    Joined:
    Apr 12, 2012
    Posts:
    10
    Right, scratch the "CrossFade on finish animations" query. Setting the animation's 'loop' option to 'ClampForever' does the trick.
     
  30. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Welcome to Smooth Moves!

    Actually, you can do this already. Just duplicate your material(s) and texture(s) from the atlas(es) you created. You can then set your maximum size on the duplicated texture(s) to a lower value for lower resolutions. Then you can call the SwapMaterials function at runtime to switch to a new material. See my material swap tutorial for more details. This will get your textures at a lower resolution.

    If you want to just make the animation smaller (while keeping the same resolution), you can scale the actual animation down by using the import scale on the bone animation asset. this modifies the mesh and animation curves.

    If you want lower resolution and a smaller game object, you can use both of these techniques combined.

    Looks like you found a solution to this in your next post below. I use a skinned mesh, so any of the animation functions are part of the Unity set of tools. I'm afraid I won't be able modify these any since they are built in to Unity.

    This would be a major rewrite and doesn't really fit in with the main purpose of Smooth Moves. I'll certainly see if it might be feasible, but I wouldn't hold my breath on this one.

    You can get around this by creating another bone attached as a child and then set the collider there. The child bone can be rotated freely.

    I'm actually working on this one for the next release. It almost made it into the last release (1.7.2), but I realized I had to rewrite more than I thought to get it all working properly. Be on the lookout for this in the near future.

    This is an interesting idea. I'll add it to my list of things to consider.

    I seem to recall someone else had this problem and they just unchecked the "Play Automatically" box on the animation component inspector to get it to work. I'd try that.

    Smooth Moves requires that you have at least two keys for the position, rotation, and scale properties. This is so that you can mix a pure sprite animation on top of other bone animations without the position, rotation, or scale causing the animation to jump around. See the mixing textures tutorial for an example of the sort of mixing I'm talking about. You can see that the knight's head blinks, yet still follows the body as he walks, stands, or attacks.

    I didn't make the requirement for multiple keys apparent in my tutorials so I released an update that warns you when you don't have enough keys for an animation curve. I'd recommend updating to the latest Smooth Moves so that you can see these warnings. That should help you fix the issues you're seeing.

    Hope this helps!
     
    Last edited: Apr 12, 2012
  31. Evil_Toaster

    Evil_Toaster

    Joined:
    Apr 12, 2012
    Posts:
    10
    Thanks for the quick reply.

    Awesome, I'll give that a go, thanks.

    Yeah, I expected it might be quite a mission. Ignoring any potential editor, would it be possible to allow one to use a mesh collider on a bone? (and while we're at it, perhaps also a capsule equivalent?) That'd then mean I'd need to look elsewhere for a way to build the actual meshes, but would be able to link to them easily in the animation editor.

    As an interim solution, I'm going to try adding a series of box colliders on sub-bones, which will be clunky and a bit inefficient, but should allow me to follow the shape reasonably well. Then it's just a case of making sure I don't end up responding to multiple collider events... perhaps by turning them off after the first collision. It's just really important to have accurate collisions on the player character specifically. Unfair/annoying gameplay will result if it's not.

    If you're able to add mesh collider support, I'll then investigate further in terms of finding an efficient process for creating the meshes.

    Already using this suggestion in the previous point. :)

    Hooray!

    Cool, I really do hope you add it. I'd like to do all my 2D animation in SmoothMoves going forward. Having the option of both sprite based or dynamic would mean I could use dynamic for complex characters, and fall back to sprite based for optimisation / simpler stuff that just doesn't need the runtime stuff. While one could do some fancy integrated solution for this, all I'd really want is for each frame to be dumped to a folder in say, a PNG with transparency. Other 2D packages like ex2D already have pretty comprehensive support for sprite based animation.

    Righto, I'll keep the above in mind going forward. I have updated to 1.7.2, and a few of the animations have a lot of warning icons on them. I'll do some cleanup there.
     
    Last edited: Apr 12, 2012
  32. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    I'm not sure that a mesh collider would do you much good since the mesh is just creating quads, which would be identical in shape to, yet slower than box colliders. I could look into the possibility of doing a capsule collider in addition to the box and sphere colliders.

    On a related note, when you create child bones to attach your colliders to, you won't need to have an image on the bone. Keeping the bone a transform only type will help in optimization since no quads actually need to be rendered. I forgot to suggest this in my last post.
     
  33. Evil_Toaster

    Evil_Toaster

    Joined:
    Apr 12, 2012
    Posts:
    10
    Cool, well, forgive me if I'm giving bad suggestions, I'm fairly new to unity. ;)

    I'm having a lot of trouble with the multiple colliders approach. As soon as I add more than one collider, collisions keep incorrectly occuring between them. It seems to be either at the start or end of an animation. I have a run animation with 2 colliders. No other animation has any. It currently occurs sometimes as the 'Jump' animation (It's set to 'ClampForever') finishes, which is before landing and before the 'Run' animation is called. If it doesn't happen there, then it occurs just after landing from a jump, where CrossFade("Run") is called. The colliders are not overlapping, and there are no transforms which would cause them to on any particular frame.

    Have you tested using multiple colliders in SmoothMoves before? Is it possibly due to how the colliders get initialised?

    Also, I don't know that much about colliders, but if possible, there should be a way to prevent ones within the model colliding with each other. (Or am I just meant to ignore the piles of events that come through? That seems wasteful though...)
     
    Last edited: Apr 13, 2012
  34. Zeugmatique

    Zeugmatique

    Joined:
    Apr 13, 2012
    Posts:
    2
    Hello,

    This tool is great for skeletal animation but I have two issues related to simple sprite animation.

    1) I tried to animate a SmoothMoves Sprite with the classic Unity Animation Editor. But when I try to move the sprite in animation mode it is always replaced on its begin pose. Any ideas how to avoid that?

    2) I also want to change the texture on a sprite by script. I only found the SetTextureGUID function. I manage to make it work in editor but this seems odd to pass by an assetPathGUID and will this work in a player Build? Is there a other solution? And will the sprite mesh be regenerated at runtime? (This would be bad)

    Notice that I'am well aware that the smooth move skeletal animation editor allow me to perform simple sprite animation but I try to animate sprites that will be spawned many times and I don't want to spawn too much skinned meshes because it's bad for performance especially because skinned mesh can't be batched.(I work on IOS so draw calls are my worst enemies)
     
  35. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Yep, you can set your physics manager to ignore collisions based on layers. To get the results you want:

    1) Set up layers. All your colliders for the animation can be on one or more layers.
    2) Set your animation game object to use the new layer (if you want to use the "Use Animation Layer" checkbox in the animation editor -- much faster to set up if you only want one layer).
    2) Make sure your animation colliders are set to the correct layers in the animation editor.
    3) Set up the physics manager to ignore collisions on the same layer.

    Note: you can have your animation colliders on multiple layers, just be sure in the physics manager that they are not set to collide with each other. In the animation editor you can then just uncheck "Use Animation Layer" and set the collider layer to whatever you want.







     
  36. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    I'll admit that I haven't given much TLC to the sprite class. It was kind of just added at the last minute so I could set up a background and target for the knight to attack in my demo scene. The sprite class is sort of a "bonus" for Smooth Moves, but it certainly isn't the selling point.

    I hate to point you in this direction, but if you are wanting to just use sprites, I'd recommend looking into the purely sprite packages out there. I only used a few of them, so I can't make a thorough recommendation, but I know there are a lot of good ones out there from what I've seen. Smooth Moves was designed primarily for skeletal animation, with an added bonus of having the ability to swap out textures on any given bone. I'd like to focus my development on that primarily. If I get some spare time, I'll revisit beefing up the sprite class. I guess what makes Unity so awesome is that you can combine numerous plugins to get the best of each world.
     
  37. Zeugmatique

    Zeugmatique

    Joined:
    Apr 13, 2012
    Posts:
    2
    Thanks.

    But isn't there at least a way to deactivate the process in the Sprite component (Or maybe its inspector) that doesn't let me animate the object or any hierarchy containing a Sprite component with the default animation editor. I just want to be able to do simple move/rotate/scale animation with it.

    I perfectly understand that sprite animation are not the purpose of this plugin, so it doesn't matter if I can't change dynamically the texture of the sprite.

    However I found the Sprite component to be very intrusive, in addition of its erratic behavior with the animation editor it won't let me rename the object in the hierarchy View and those two things seem very buggy to me.
     
  38. Evil_Toaster

    Evil_Toaster

    Joined:
    Apr 12, 2012
    Posts:
    10
    Awesome, thank you for the detailed explanation. Bananaman is no longer falling on his face for no apparent reason. :) Looks like I didn't pay enough attention in the video tutorials, I recall you did point out the collision matrix in one of them.

    Just one last thing regarding the whole polygon collider thing that's bugging me. (Again, excuse me if I sound uneducated here) Lets say one is working in 3D, with character models containing 1000 polygons. Surely it wouldn't make sense to use a 1000 poly mesh for collision, where a much lower resolution one would do? Following that, surely unity allows one to attach a separate mesh to use for collisions? So the question is... why does it matter if the render mesh is a quad, can one not attach a separate one for collision purposes? If you're able to use a sphere collider (which is not a quad) in SmoothMoves, why can one not bring in a custom collider with some other shape?

    Since anything you add under root via the unity interface seems to get wiped on play, even if I am able to make a polygon collider, I wouldn't be able to attach it unless the editor supported doing so. The only semi workable solution that comes to mind would be an invisible object with a polygon collider that is locked to the character via a script which constantly polls and duplicates the positional/rotational/scaling values of the bone it wants to follow. This could get quite complex/expensive if sub-bones contain only relative positions. (Which would then need to be translated into world space)
     
    Last edited: Apr 14, 2012
  39. undream

    undream

    Joined:
    Dec 24, 2011
    Posts:
    27
    Hello Echo17,
    Here is another small but very important issue about drawcalls.

    Currently I see no way to create sprites other then creating a bone animation and keyframing each frame to match the frame of the animation, however, this is very hard to accomplish for animations with high frame count and more importantly it increases the drawcalls (because of the unnecessary usage of skinned mesh).

    I'm wondering if there is any other workaround for this case since this way it'll be impossible to use for us in our project because of the draw-call performance issues.

    Thanks.
     
  40. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Honestly, I haven't tried to use Unity's built-in animation editor on my sprites, so I'm not sure what it could be doing to the sprite object. I'll have to play around with that to see what is going on.
     
  41. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    I believe the mesh collider is a special collider that only works with a provided mesh. Since the mesh created in Smooth Moves is only a collection of quads, you'd get a collider that is almost the same as a collection of box colliders, only slower. I guess I'm not visualizing very well how a mesh collider would be any better in the case of a 2D animated mesh.

    You can always attach objects to a bone at runtime. You can create your objects at design time (unattached to anything), then at runtime attach them to the bone you want by setting their transform's parent to the bone of your choice.
     
  42. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    Well, since this is primarily a 2D skeletal animator, I don't think of the skinned mesh as unnecessary, quite the opposite. The skinned mesh is the crux of the system, allowing a skeletal character to be animated smoothly. The sprite animation is what should be considered an added feature to the skeletal system, giving it the flexibility that is sorely needed in animations imported from 3rd party animation tools such as 3DS max, Maya, and Blender. The sprite animations let your bone character switch poses, change facial expressions, switch out accessories, etc.

    You can certainly use Smooth Moves solely as a sprite animator, but that is not the primary purpose of the tool, so you will certainly see some drawbacks such as the draw call issue. Rather than making Smooth Moves a tool that can do everything kind of good, I'd rather focus on making it a tool that can do skeletal animation really well.
     
  43. Evil_Toaster

    Evil_Toaster

    Joined:
    Apr 12, 2012
    Posts:
    10
    Ok cool, as long as it doesn't get wiped when animations are switched, that should be fine. I'll look elsewhere for a way to build polygon colliders, then attach at runtime. Perhaps I can use the ones made by 2D Toolkit. I had a go at trying to make a collission mesh in blender, and have concluded that I have absolutely no idea what I'm doing there. ;)

    I think I'm pretty much sorted for now in terms of immediate issues, thanks for all your help.
     
  44. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    No problem. The bone structure won't get wiped between animations, only at the start of the scene since the bone hierarchy is static, so you should be good to go there.
     
  45. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    Does it do inverse kinematic ?
     
  46. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    if I combine two atlases, or move a texture from one atlas to another, what happens to all the sprites using that texture ?
     
  47. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    No, not at this time. I may add this in at a later date, but I don't have a good projection on that.
     
  48. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,256
    You would need to reassign your atlases in the sprites and animations if you move your textures to a new atlas. The unique texture identifier would remain the same (the asset database GUID) so you wouldn't need to reselect your textures, but the atlases would obviously be different, so that would require that you change them wherever they are referenced.
     
  49. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    How does skinning work ?
    I only see segmented animation.
     
  50. llavigne

    llavigne

    Joined:
    Dec 27, 2007
    Posts:
    977
    You need to look at ex2D.
    If you move a texture to another atlas, the atlas reference is automatically re-assigned in all the prefabs and scene that use the texture.