Search Unity

Dynamic Bone - Realistic swaying ponytail and bouncing boobs

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

  1. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    do you mean we need a parameter to supress dynamic bone's simulation when character's pose change a lot ?
     
  2. tgiddings000

    tgiddings000

    Joined:
    Mar 1, 2021
    Posts:
    5
    Sorry for the delay. Unity apparently didn't feel like emailing me. It's not a matter of suppressing the simulation as a whole. It's ignoring one of the things that affects it. Semantically, it's almost the same as "inert" -- just replace "character's position change" in the tooltip with "character's animation"

    I took a look at the source code to see if I could make an implementation-oriented description. I'm not sure how much I'm supposed to publicly discuss the implementation details of the script.

    I managed to make a working proof-of-concept that I can send to you, if that helps.

    I noticed that "Inert" only ignores the translation of the GameObject. Rotation still affects the simulation. I'm not sure how often this is an issue for ignoring the GameObject's motion, but when trying to ignore the character's animation, rotation definitely needs to be taken into account. Almost all animation is bone-rotation.
     
    HorngYuiWei likes this.
  3. Silverfields

    Silverfields

    Joined:
    Mar 21, 2021
    Posts:
    2
    Question relating to the performance of Dynamic Bones;

    How does Dynamic Bones do its calculations? Is the math done on a single CPU core or is it done on multiple? Is that set by the game engine that Dynamic Bones is running within?

    I've been encountering performance issues with situations where there are 10+ people using avatars with many dynamic bones in VRChat. While the game does offer the ability to limit or completely disable them, I'd like to know whether it is possible for further performance optimizations to be made.

    Thanks in advance for the answer!
     
  4. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    currently, all calculations are done in Unity's Update() and LateUpdate()
    so only main thread is used.
     
  5. Silverfields

    Silverfields

    Joined:
    Mar 21, 2021
    Posts:
    2
    Is it possible to spread the processing load across more threads? Or is there a limitation elsewhere that makes that impossible?

    Thank you for answering my questions, I imagine you get a lot of questions relating to VRChat when that isn't your primary focus.
     
  6. mightybaitgames

    mightybaitgames

    Joined:
    Jul 4, 2019
    Posts:
    1
  7. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
  8. Gamingbir

    Gamingbir

    Joined:
    Apr 1, 2014
    Posts:
    197
    Hi, I am not sure how to make this work. I followed the instructions on the text file but my hair and the breast is not having the animation that they should do.
     
  9. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    please give more information what problems you meet.
    You can also send a test project to willhongcom@gmail.com.
    I'll look into what's wrong with it.
     
  10. Stupeflip

    Stupeflip

    Joined:
    Mar 20, 2016
    Posts:
    10
    Hello :) Is there a tutorial to make it work with model from CC3+ (characater creator 3) ? Thank you
     
    Rajmahal likes this.
  11. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
  12. Mbastias

    Mbastias

    Joined:
    Jan 1, 2015
    Posts:
    6
    Does this work with the 2D animation package, it would be overkill on performance or it needs the 3D geometry kind of bones?
     
  13. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Dynamic Bone should work with 2D animation.
    Adjusting "Project Settings -> Script Execution Order", put Dynamic Bone above "Default Time".
     
    andre-ivankio and Mbastias like this.
  14. Wippo

    Wippo

    Joined:
    Jan 2, 2015
    Posts:
    4
    Hello,

    thanks for creating this handy tool @HorngYuiWei
    is it possible to influence how much a characters Rotation influences dynamic Bones?
    As far as my tests went the inert value is only for velocity. So whenever I rotate my Character the Bones rotate too extreme. Is this the expected behaviour or is it specific to my setup that inert does not take rotation into account?
    (I have different hairstyles each with their own rig that get parented to the Head Bone of my Character)
     
  15. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Inert only consider position, rotation is not take into account.
     
    Wippo likes this.
  16. Wippo

    Wippo

    Joined:
    Jan 2, 2015
    Posts:
    4
    Thanks for your answer.
    Just to be sure: I assume there is no Option to dampen the effect when I quickly rotate my Character?
    Sorry for the late response. (I am not very active here and did not receive an email notification)
     
  17. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    yes
     
    Wippo likes this.
  18. Stupeflip

    Stupeflip

    Joined:
    Mar 20, 2016
    Posts:
    10
    Hello, first it's a very good asset !

    I am making and FPS and I want my player weapon to collide with dynamic bone object.

    For example, the player hold a woodstick and I want the object with dynamic bone to react when the stick touch it.

    How can I make the stick collide and react with game object with dynamic bone ?

    Thank you :)
     
  19. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Add Dynamic Bone Collider component to stick.
    then add the collider to "Colliders" parameter of Dynamic Bone component.
     
  20. Sea_Kerman

    Sea_Kerman

    Joined:
    May 20, 2018
    Posts:
    3
    I'm having an odd problem with using this on a robot model I am making. Whenever I activate freeze axis, the bone rotates a bit, misaligning it. https://imgur.com/a/8X1zuPz
     
  21. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Freeze Axis works by align bones to it's parent.
    you can try modify parent node's transform.
     
  22. Sea_Kerman

    Sea_Kerman

    Joined:
    May 20, 2018
    Posts:
    3
    Could you clarify? Do you mean it points some axis of the relevant bone at its parent, or that it tries to align the axises of the bones? This doesn't seem right, as the antenna's bone (3) is not pointed at its parent bone (2), nor are its axises aligned when this oddness occurs.

    Perhaps it would clarify if I show how the bones are set up.

    The small bones (1 and 3) are what I want to apply physics to, to allow the antenna to wiggle, constrained to a single axis to emulate being on a shaft or bearing. The large bones are then animated. (perhaps I should animate the small bones and dynamic bone the large ones? But then the antenna (bone 4) rotates a full 90 degrees on its x axis when I try to freeze to its z axis...)
     
  23. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    For example:
    set Freeze Axis to X, bones will move on plane, which is defined by parent bone's position and X axis
    You can also mail a test project to willhongcom@gmail.com
    I'll look into it.
     
  24. Sea_Kerman

    Sea_Kerman

    Joined:
    May 20, 2018
    Posts:
    3
    I figured it out! "end length" extends it in the direction of the connection fron the previous bone to the current bone, which in this case is diagonal. I want "end offset" instead, which let me just extend it directly up, so everything lines up correctly.
     
    HorngYuiWei likes this.
  25. Brady_Jin

    Brady_Jin

    Joined:
    Jan 29, 2021
    Posts:
    1
    Hello HorngYuiWei, I want to know :Is there any way to preview the dynamic bones in the Unity editor mode? (I know you can preview it in gameplay,)
     
  26. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    no.
    you can create a simple scene only used for preview.
     
  27. zvarri91

    zvarri91

    Joined:
    Jul 26, 2021
    Posts:
    1
    I've been stuck on this problem for a few days now... Is there any way to apply a dynamic bone to a bone with a parent constraint? I'm trying to get a bone to jiggle AFTER the parent constraint is applied.

    When I try to apply the dynamic bone directly to the constrained bone, the mesh won't deform. I realized the constraint is probably locking the bone in place. Below, DynamicBoneRoot both contains the Dynamic Bone component and is set as the Dynamic Bone Root:
    Armature
    |-DynamicBoneRoot
    |-DynamicBone (Parent Constrained)


    Then I tried making a copy of the constrained bone where the first/original bone is now a non-deforming bone with the parent constraint and the other deforming bone is the first bone's child with dynamic bone applied. Again, DynamicBoneRoot both contains the Dynamic Bone component and is set as the Dynamic Bone Root:
    Armature
    |-DynamicBoneRoot
    |-NonDeformingBone (Parent Constrained)
    |-DynamicBone


    This still results in the same behavior as above. I thought maybe the parent constraint is still locking the child bone, but if I disable the dynamic bone component, moving the child bone actually does deform the mesh properly. I've also tried setting the Dynamic Bone Root to NonDeformingBone (i.e. DynamicBoneRoot contains the Dynamic Bone component, but the Root is set to NonDeformingBone) with the same results.

    This is for a VRChat avatar, so unfortunately I can't use anything outside their component whitelist.
     
    Last edited: Jul 26, 2021
  28. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    please send a test file to willhongcom@gmail.com
    I'll look into it.
     
  29. SmoothBlue

    SmoothBlue

    Joined:
    Oct 4, 2021
    Posts:
    2
    Hello.

    I'm not sure where the best place for this is, but I have a small request. An option to add multiple Root Bones similar to how you can add multiple Colliders/Exclusions for example.

    Also, maybe a bug. It's related to VRChat in my personal experience, so I can't confirm whether it's the game or Dynamic Bone itself since there's no communication on their part about this issue. The physics in game tend to be jittery, and apparently it wasn't like that before. In fact, older models don't have this jittery behavior, only newer ones, so that's why I thought to at least bring it up to you, as maybe you can at least do something with that information.

    Best regards.
     
  30. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    from version 1.2.2, “Update Mode” parameter is changed from "Normal" to "Default".
    "Default" is faster and most of time looks better. But in some situation may looks jittery. You can verify is it the reason.
    There are some requests about multiple root bones. I'll consider it seriously.
     
  31. SmoothBlue

    SmoothBlue

    Joined:
    Oct 4, 2021
    Posts:
    2
    Hi.
    Thanks for the reply, and thanks for considering the request for multiple root bones.

    About the jittery physics, I have tested the "Normal" update method, and it does still jitter in the same way as "Default" method.

    Thanks again, and regards.
     
  32. shma_unity

    shma_unity

    Joined:
    Jun 13, 2018
    Posts:
    118
    Hello,
    I've added several dynamic bones to my scene. It works on some, but whenever I set gravity, the simulation doesn't seem to be run properly (as if the gravity is suddenly 100x as much), until I change a parameter in play mode (e.g. set friction from 0 to 0.0001 and back to 0). After that, everything looks and works completely fine.

    Is there something I have to call when the simulation starts to properly apply the gravity?
     
  33. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    "Gravity" depend on characters' initial pose. It's better to not change gravity in play mode.
    "Force" is independ on initial pose. It's ok to change force in play mode.
    The issue is fxed in version 1.3.
     
    Last edited: Dec 9, 2021
  34. mrlafle

    mrlafle

    Joined:
    Sep 17, 2015
    Posts:
    3
    Hello, great work on this package! I'm just having a little trouble with the SetWeight()

    Code (CSharp):
    1. if (Input.GetKeyDown(KeyCode.Space))
    2.         {
    3.             db1.SetWeight(0.76f);
    4.             db1.UpdateParameters();
    5.         }
    db1 is the public DynamicBone I've defined in the inspector. But calling these functions do not affect the stiffness value. Am I doing something wrong?
     
  35. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    SetWeight() change stiffiness indirectly. the stiffness value is not changed.
    You can look at DynamicBoneDemo1.cs for example.
     
    Last edited: Dec 10, 2021
  36. Alex-3D

    Alex-3D

    Joined:
    May 21, 2013
    Posts:
    79
    Dynamic Bone in the build has disgusting shaking at any settings.
    Did the author check his Asset in the build?
     
  37. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Sorry, what does "in the build" mean?
     
  38. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Please write more detail information about problems you meet.
    or mail to willhongcom@gmail.com for support.
     
  39. ArpadTerek

    ArpadTerek

    Joined:
    Jan 22, 2018
    Posts:
    3
    Hi, I have a question. I'm trying to use the Dynamic Bone on a 2D sprite. The funny thing is that the bones are moving as they should, but they doesn't transform the mesh assigned to them. In the editor when I move the bones they behave normally, but once I enter play mode the bones are bouncing properly but not moving the sprite.
     
  40. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    You can try adjust script execution order:
    Form menu Project settings->Script Executing Order
    add dynamic bone, move it's order before "Default Time"
    upload_2022-1-11_14-51-27.png
     
    ArpadTerek likes this.
  41. ArpadTerek

    ArpadTerek

    Joined:
    Jan 22, 2018
    Posts:
    3
    Thank you! Now it works, you are the best!
     
  42. ArpadTerek

    ArpadTerek

    Joined:
    Jan 22, 2018
    Posts:
    3
    Hi, sorry but I got another question :) Should Dynamic Bones work in a WebGL build?
     
    Last edited: Jan 16, 2022
  43. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    It seems WebGL build does not support multithread correctly.
    Please mail to willhongcom@gmail.com
    I'll provide a quick fix version
     
  44. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    65
    Is this now changed in the current version? Is multithreading on by default?
     
  45. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    38
    Hey Will, can you pull on tails using this? and have it spring back?
     
  46. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Yes, multithread is enabled by default in version 1.3.
    Unity DOTS is not used now. Performance improvement may not as good as you expected.
     
  47. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    You can use Dynamic Bone Collider to interact with tail.
    but tail length is keep unchanged.
     
  48. jxstleana

    jxstleana

    Joined:
    Jan 17, 2022
    Posts:
    2
    hi,

    i bought it dynamic bone but can't add it to my unity. When I press open in Unity nothing happens
     
  49. jxstleana

    jxstleana

    Joined:
    Jan 17, 2022
    Posts:
    2
    do i have to buy new dynamic bones for every avatar i buy ?
     
  50. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Please look at console window to see is there any error message.
    You can also mail to willhongcom@gmail.com for support.