Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Dynamic Bone - Realistic swaying ponytail and bouncing boobs

Discussion in 'Assets and Asset Store' started by HorngYuiWei, May 11, 2014.

  1. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    2dchaos likes this.
  2. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Hello,

    what i saw is awesome. I would say, this is a standard asset/script that everybody should have. If there comes to animation (for intro, and also ingame), there are lot of thing that should be working dynamically, and to animate these things manually needs unnecessary time. However, i hope using this script ingame for an RTS won't decrease too much my frame rate.
     
  3. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    You can use SetWeight() function to control how physics blend with animation.
     
    LysolPionex likes this.
  4. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Dynamic Bone use its own physics simulation which is fast enough for most situation.
    You can disable some of them if there are too many units on the screen.
     
    Last edited: Dec 16, 2014
  5. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    748
    So on Tilo the dynamic props/assets (which you can all see in action in the Vine) are:

    - Both ears
    - The tail
    - The hood
    - The pouch on his belt (left side)
    - The purse on his belt (right side)

    The nice thing is they all blend nicely with existing animation. So the personality of the character (him checking his tail or touching his ears) is intact, which was important in the case of Ghost of a Tale... :)

    PS: If anyone knows how to embed a Vine video in a forum post, please let me know...
     
    Arkade likes this.
  6. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    748
    That's what I did as well: I check in an update function the distance between the characters and the camera. And I disable the dynamic components if the characters are beyond a certain distance. That way it doesn't spam the system.
     
  7. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    I can see what you did as being a standard function for this asset, @HorngYuiWei can you add this in your next update?
     
  8. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    748
    I agree it's a good idea. The component would just need 2 more variables: the camera used and the deactivation distance threshold. Both of which could get default values (eg: the scene's MainCamera and 20f).

    Then the component's Update loop would have to exit right away (without any further calculations) if the distance is too great.
     
  9. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Good idea. I'll add it in next release.
     
  10. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Thanks for your comment. Sounds logical.
     
  11. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    Great! Thanks for the reply. Yes, you've really created / captured some great character in your hero!
     
  12. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,959
    Super awesome asset! I replaced my old bouncy bounce bouncer with Dynamic Bone and it works great. I love the ability to make curves for the settings, that really helps to tweak it exactly how I want it.

    I was wondering if there is a way to use a different type of collider in addition to the spherical\cylindrical "Dynamic Bone Collders". Mainly because I'd like for the dynamic elements to collide with the floor, tables, etc. Is it possible to set up a box collider for that?
     
  13. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    Hey. FYA, I'm integrating Dynamic Bone into my game -- Snowman Scuffle.

    Using to make the player characters 'wobbly'. Looks great (IMHO) though haven't decided whether they should wobble from base or face (they're self moving so face makes more sense but feel base looks more comedic!) Thoughts welcome!

    https://vine.co/v/Own5xH67Pet
     
  14. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    OK, run into a slight hitch that would appreciate thoughts on (probably from author @HorngYuiWei ). I have an idea but it would seem to require some additions to the asset.

    How to prevent nose from passing through helmet? (pic shows him in freefall starting in left pic)


    Bones configured per this diagram:


    The helmet is not a skinned mesh -- merely placed as child of the hat bone that sticks out of the top. (this works fine since don't need flex in the hats.)

    AFAICT the current available solution would be a DynamicBoneCollider on the helmet directly above the nose. Tried this but, of course, it pushes the rest of the head and hat out of the way.

    I have DynamicBone radius set to about nose size and a straight (1 to 1) Radius Distrib. Obviously the Radius Distrib isn't great for my setup since I really need no collider anywhere but the nose. Any way to achieve?

    On top of that, the sphere approach isn't great since I really need a plane or convex volume for the hat (i.e. keep the nose -- and only the nose -- out of its volume). As I said, a plane placed below the helmet would suffice.

    In case relevant, I have lots of other hats but this one's comes lowest.


    Thanks for anything you can offer!
     
  15. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    Also, extra question: How hard would it be to have Dynamic Bone work with non-SkinnedMeshes? (i.e. hierarchical objects moving relative to one another in Dynamic Bone's control but without flexing their surfaces)

    Just realised that, at the zoom my game /mostly/ runs (at the moment), one *can* see the GameObjects moving relatively but one *can't* really see the surface flexion! ... so I could probably leave it off.

    (also, look! wobbly hats that react to impact! This was a well worthwhile xmas integration :-D )
    https://vine.co/v/Ow3qQeADXI0

    Thanks.
     
    hopeful likes this.
  16. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    Self answering the non-skinned mesh question (maybe)...

    I just realised a way that might work (without changes to the asset)! In my modelling package (Blender), if I don't parent and weight my mesh to the bones, they'll import as non-skinned but all positions would be correct. I could then manually parent them in Unity and apply Dynamic Bones as before.

    Will try it later!
    (still hope for author's help on the helmet problem. Thx!)
     
  17. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    hmm... actually after reading a bit of your beautiful code, I find myself wondering whether it's even tied to bones? Would it work with a hierarchy of Transforms! Again, to test later!
     
  18. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Box collider is not supported now.
    I'm considering to support unity's build-in colliders, but the performance may suffer a lot.
     
  19. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Yes, dynamic bone works with any hierarchy of transforms, not tied to character's bones.
     
    dadude123 and Arkade like this.
  20. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,959
    Okie doke. I partially solved it by putting a large Dynamic Bone collider directly under my character and that works fine for a floor collide for now.
     
  21. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,664
    +1 for bouncing boobs in games.

    I approve of your asset! :D
     
    Ony likes this.
  22. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    I guess this response was also to my "nose - helmet" question?

    If it might degrade performance much, I wonder whether a few approximations might suffice?
    For mine, a plane would do. For box needs, perhaps a plane with effective range (i.e. a disk) would work for many cases? (e.g. Floor chunks)

    Thanks! (inc. for the reply re. hierarchy control - that's great!)
     
  23. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    Here's a patch for DynamicBone that adds debug values to the OnDrawGizmos() call so you can tell which bones have which values, etc.
    HTH
    EDIT: Added link!
     
    HorngYuiWei likes this.
  24. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,403
    I'm trying to use DynamicBone to rig up a tree to sway in the wind. I'd like branches of the tree to move independently and out of phase with each other, as if they are being affected by a gust of wind at different times as the wind propagates across the surface of the tree. So is there a way to apply forces to the tree in this way? I only see a single "Force" setting in the inspector of the DynamicBone script, which I have set to the root (trunk) of my tree, but I'm wanting forces to be applied to the branches at different times and intensities. Is this possible somehow? Thanks!
     
  25. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,403
    Incidentally, I'm extremely impressed with DynamicBone and pleased with my purchase. It is incredibly easy to implement and yields amazing results, especially considering there is almost no initial setup needed on my part. Well done!
     
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,394
    I'm thinking that instead of trying to get different intensities of force applied to regions of your tree, try to change the springiness of various areas. When the initial gust comes all the branches will move in unison, but after that won't they move independently due to the different settings on the limbs?
     
  27. adventurefan

    adventurefan

    Joined:
    Jan 17, 2014
    Posts:
    209
    You could always simulate wind by animating an invisible collider object or a few passing through. Then loop it, script a slightly random time to reset it, or whatever you like.

    I dunno if DB is great for that though. The built-in tree builder actually does all that if you make an animated wind zone (spherical type) though.
     
  28. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,403
    The springiness approach might yield a desirable look, however, I'm still not sure how to assign different springiness settings to each branch, since once I put a DB component on a root bone, it automatically affects all subordinate bones. Or are you saying to add multiple DB components down the hierarchy? And then would I just alter the "force" setting of each component at runtime?

    Regarding the tree builder, yeah, I know, but I need this to work for a hand-drawn sprite that I'm deforming using bones.
     
  29. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    5,791
    This works well, except when my characters are moving quickly (like on a horse). Then it goes nuts. Is there a way to cap the amount of force that is applied, or apply based on local movement (not global) It looks great when characters are just walking around.
     
  30. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Try increase "Inert" to reduce global movement.
     
  31. jaelove

    jaelove

    Joined:
    Jul 5, 2012
    Posts:
    302
    Great asset is this compatible with Unity 5?
     
  32. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    Quick reply until author gives official answer...
    Yes, it appears to be. Started my project with Unity 4, upgraded to Unity 5 and DB is still working fine AFAICT.
    HTH
     
  33. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    642
    P.s. in case you're curious, here are my snowmen in Unity 5 - wobbling from the base under Dynamic Bone:

    Snowman Scuffle: New ice shader, shot trails & powered-up cricket bat:
     
    HorngYuiWei likes this.
  34. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Yes, Dynamic Bone works well in Unity 5.
     
  35. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,934
    Hi, is there a possibility to have a completely per-frame "run-time allocation free" version of this.

    It would be nice to roll this out across 100 animated animals for various body parts but 100x any run-time allocation gets expensive immediately. So I have to ask.


    EDIT: probably eminently fixable.

    Also I sent you a mail to your RL mail. cheers
     
    Last edited: Apr 8, 2015
    Arkade and hopeful like this.
  36. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    In the new version of Dynamic Bone. All "foreach" are removed to reduce run-time heap allocation.
     
    Arkade, twobob and hopeful like this.
  37. Zenchuck

    Zenchuck

    Joined:
    Jun 2, 2010
    Posts:
    283
    What is the performance hit vs. regular bone animation?
     
  38. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Dynamic Bone use its own physics simulation which is fast enough for most situation even on mobile.
    If you are not sure is it works for your project, please mail to willhongcom@gmail.com to request for an evaluation version.
     
    Last edited: May 6, 2015
  39. LAiKA787SV

    LAiKA787SV

    Joined:
    May 6, 2011
    Posts:
    60
    So, I was making a skirt with this and it likes to passing through the skins. I've tried every method to make skirt flow like bullet physics (it so flawless). I tried with making rigidbody and add character joint and it still passing through. I though this gonna be good, but still can't fix it.

    I also tried to ask people in forum, but it just like I'm asking with walls.


     
  40. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,394
    2dchaos likes this.
  41. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    You can add Dynamic Bone colliders to legs or hips.
    If it still not works well, you can mail files to willhongcom@gmail.com, so I can see what's wrong within it.
     
  42. LAiKA787SV

    LAiKA787SV

    Joined:
    May 6, 2011
    Posts:
    60
    As you can see on that yellow wire sphere, I already add your Dynamic Bone Colliders. When white wire collider touches yellow wire collider, it likes to moves left or right.

    I think it maybe can be fixed if the Dynamic Bone White Wire Sphere collider is box collider. Cause if it's sphere, it likes to moves left and right passing through skin.
     
  43. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    764
    Is there a way to increase amount of white colliders? Because if bones are far apart, the white colliders will be too, and yellow colliders will clip right through between them. That doesn't look good.
     
  44. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    I'm considering add extra white colliders between bones.
    You need to add more bones to increase collide precision now.
     
    brutecold likes this.
  45. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    764
    Allright, thanks.

    Extra colliders between bones would be really useful. :)
     
    brutecold likes this.
  46. rdvt

    rdvt

    Joined:
    Aug 23, 2014
    Posts:
    23
    I bought Dinamic bone and it's great!!!!!!!

    I use mixamo characters but i like to add bones to breasts. Do you have any tutorial to help me? I use blender.

    Thanks
     
  47. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    Hi, can this also be used to have collisions between the dynamic body parts with (static) world geometry?
     
  48. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    946
    Hi, I just bought this and it's great.
    I'm having trouble setting a tail to move smoothly when a character is running at high speed.
    Could you make some example with some character running very fast?
    My tail move like crazy, and I can't make it smooth. At moderate and slow speed is ok.
     
  49. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    Dynamic Bone only collide with it's own colliders, not with Unity' physics object.
     
  50. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    163
    You can try to increase "Inert" to cancel out character's movement.
     
unityunity