Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dynamic Bone - Realistic swaying ponytail and bouncing boobs

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

  1. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    You can try this:
    1. open project setting
    2. select script execution order
    3. add dynamic bone
    4. move dynamic bone above default time.
     
  2. james_work

    james_work

    Joined:
    Oct 2, 2020
    Posts:
    10
    We have been using your Dynamic Bone plugin in our projects and are overall pleased with how it works.
    However, we are having some performance issues on lower-spec devices, and were wondering if it's possible to perform the physics calculations to a different thread, or perhaps optimize it by making use of the burst compiler and/or ECS.

    If it's not currently possible to do so, we would like to attempt to implement this ourselves - so if you have any pointers, or any suggestions etc. please let me know.

    Kind regards,
    James
     
  3. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Dynamic Bone already use threads to do some of the simulation.
    DOTS not used now.
     
  4. james_work

    james_work

    Joined:
    Oct 2, 2020
    Posts:
    10
    Thank you for confirming. We have upgraded to the latest version and can confirm that performance has improved.
     
  5. CRISTALSONIC

    CRISTALSONIC

    Joined:
    Sep 22, 2016
    Posts:
    136
    has any one tried to set up dynamic bone on iclone 4 characters yet ?
    (don't have time to read 11 pages of post right now lol)

    some of the settings don't seem to do much, I don't notice any difference when changing any of the disrupt perimeters
     
  6. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    iclone4 characters should be ok.
    what parameters you change?
     
  7. CRISTALSONIC

    CRISTALSONIC

    Joined:
    Sep 22, 2016
    Posts:
    136
    its good now
     
  8. RamonLion

    RamonLion

    Joined:
    Jul 19, 2012
    Posts:
    11
    Hello!

    I wanted to know if Dynamic Bone works on Sprite Skeleton Rigs.
    It doesn't appear to do anything or respond at all, so I feel I'm out of luck.

    Tried setting up execution order and stuff but the bones do nothing. Animator is disabled, No IK active. Still the bones do nothing.

    Frustrating because they are just transforms...
     
  9. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Hi,
    Select Edit->Project Settings->Script Execution Order.
    Add Dynamic Bone and move it before "Default Time".
    If it still not work. Please send a test Unity project to willhongcom@gmail.com
     
  10. smash-ter

    smash-ter

    Joined:
    Sep 6, 2020
    Posts:
    22
    would this be a consideration for an update sometime in the future?
     
  11. Kst001

    Kst001

    Joined:
    Sep 14, 2021
    Posts:
    16
    Hello. Is it possible to use Dynamic Bone to make skirt movement look realistic?
     
  12. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Yes,
    you need to add bones to skirt meshes.
    but collisions with legs are hard to handle well.
     
  13. Lunarthewolf

    Lunarthewolf

    Joined:
    Feb 10, 2019
    Posts:
    10
    Hi, I'm using Dynamic Bone for my character's scarf. It behaves as expected most of the time, but for some reason, certain animations cause it to seemingly ignore the -0.1 gravity I'm applying in settings. It's the same settings in both cases, so I'm not sure why this is happening.
     

    Attached Files:

  14. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    You can try use "Force" instead of "Gravity".
    Because gravity apply to character's initial pose is cancelled out.
     
  15. Lunarthewolf

    Lunarthewolf

    Joined:
    Feb 10, 2019
    Posts:
    10
    This seems to have fixed it, thanks!
     
  16. Parapin

    Parapin

    Joined:
    Mar 31, 2017
    Posts:
    14
    hi, i want to ask how i can completely ignore, on some bones the velocity force, i think is that the name, and let it only react on the in place walking animation even when the character is moving. and maybe let it work again after a velocity threshold...
     
  17. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    You can try increase "Inert" parameter.
     
  18. Parapin

    Parapin

    Joined:
    Mar 31, 2017
    Posts:
    14
    mmm no, tried it... no the inert parameter is not really working, the in place walking animation and when it moves is clearly different...
     
    Last edited: Sep 11, 2023
  19. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Please send a test Unity project to willhongcom@gmail.com
    I'll look at it.
     
    Last edited: Sep 15, 2023
    Parapin likes this.
  20. Parapin

    Parapin

    Joined:
    Mar 31, 2017
    Posts:
    14
    i sended you an unity scene, some day ago. thank
     
  21. AustinDrozin

    AustinDrozin

    Joined:
    Jun 8, 2016
    Posts:
    43
    Hi so this plugin is great! One problem I'm facing though is that I can't seem to have the script rotate one of the joints. It's only moving it's position value, not the rotation. Is that meant to be the case? I have a neck joint that should rotate so the head whips back and forth, but it's just moving the position. Rotation isn't changing at all.
     
  22. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    If the joint has more than one children, It will only move without rotate.
    You can try add some of the children to "Exclusions" list, leave only one child of neck joint.
    Neck joint should rotate as expected.
     
  23. AustinDrozin

    AustinDrozin

    Joined:
    Jun 8, 2016
    Posts:
    43
    Oh interesting. So what do you recommend I do if my joint setup is like this:
    upload_2023-10-17_16-54-42.png
     
  24. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    You can try add all nodes except "Head" to "Exclusions" list.
     
  25. AustinDrozin

    AustinDrozin

    Joined:
    Jun 8, 2016
    Posts:
    43
    If I do that then those other excluded meshes don't move with the head. So the face clips through the head mesh, etc
     
  26. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Please send a test unity project to willhongcom@gmail.com.
    I'll found out is there any solution.
     
  27. AustinDrozin

    AustinDrozin

    Joined:
    Jun 8, 2016
    Posts:
    43
    ok thank you. Sent!
     
  28. mcmount

    mcmount

    Joined:
    Nov 15, 2015
    Posts:
    83
    I have couple of ideas how to improve the Dynamic bone. Maybe the author can catch up with some of them.

    When talking about ponytails:

    1. Using gravity or force is simply hopeless to get a realistic behavior. This is why I tend to use a dummy gameobject with the DB root, which is at the same position x-z wise, but at the floor level. Then I aim the root bone with an offset to the dummy gameobject. The script execution order assures the aiming goes first before the DB kicks in. I'm controlling the head joint with another script, which takes care of eye movements, blinking and the look targets for the head and the eyes. After this, the DB is executed, gravity is non useable and the force (0,-.0001f,0) is about the best you can do. So yes, I need this extra script to balance the DB calculations.

    2. Friction. This is a big issue. There is no way to have any friction, so let's say your character looks down with a ponytail. The only thing you can do is to create DB colliders to the upper body. But still, how the ponytail reacts looks really silly without any friction. The length of the ponytail might be like shoulder length, haven't tried insanely long ponytails.

    3. Limiting the distance of the joints. Currently, there is no limit, so I had to come up with something. I'm using this script to limit the distance with each joint;

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class BoneLimitMovementLocal : MonoBehaviour
    4. {
    5.     public float radius = 1f; // The radius within which the bone is allowed to move.
    6.     private Vector3 initialLocalPosition;
    7.     public Transform[] bones; // The bones in your Dynamic Bone chain.
    8.  
    9.     void Start()
    10.     {
    11.         foreach (Transform bone in bones)
    12.         {
    13.             // Store the initial local position of each bone.
    14.             bone.gameObject.AddComponent<BoneData>().initialLocalPosition = bone.localPosition;
    15.         }
    16.     }
    17.  
    18.     void LateUpdate()
    19.     {
    20.         foreach (Transform bone in bones)
    21.         {
    22.             // Get the stored initial local position.
    23.             Vector3 initialLocalPosition = bone.gameObject.GetComponent<BoneData>().initialLocalPosition;
    24.  
    25.             // Calculate the displacement from the initial local position.
    26.             Vector3 displacement = bone.localPosition - initialLocalPosition;
    27.  
    28.             // If the displacement magnitude exceeds the radius, clamp it.
    29.             if (displacement.magnitude > radius)
    30.             {
    31.                 // Calculate the direction of displacement.
    32.                 Vector3 direction = displacement.normalized;
    33.                 // Set the local position to the boundary of the radius.
    34.                 bone.localPosition = initialLocalPosition + direction * radius;
    35.             }
    36.         }
    37.     }
    38. }
    39.  
    40. // This class is used to store the initial local position of each bone.
    41. public class BoneData : MonoBehaviour
    42. {
    43.     public Vector3 initialLocalPosition;
    44. }
    45.  
    So, my request is to pay attention to these features, as DB is good, but it can be INSANELY good!
     
    Will-Hong likes this.
  29. geplourde

    geplourde

    Joined:
    May 31, 2017
    Posts:
    23
    the bones looks great in normal animations, but I have a character riding a boat at high speeds. The bone physics wigs out, any tips to support a character's bones moving on a fast vehicle?
     
  30. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Try increase "Inert" parameter.
     
  31. geplourde

    geplourde

    Joined:
    May 31, 2017
    Posts:
    23
    With inertia maxed at 1.0, there are lots of weird jitters going on still.

    I added the Demo's character +and increased its inertia as well, same result.

    note: both characters are direct children to the jetski, which has a rigidbody and is moved using rigidbody physics.

    This makes me think something isn't working correctly.

    Here are clips in action (i increased the model size and faced camera to better show the physics issue)





    edit: after further testing, it seems that the 'Inertia' parameter doesn't account for character rotation. Is there a remedy for this? Specifically, staying to the root of the problem, calibrating the physics to work on moving vehicles like in the clips above.
     
    Last edited: Nov 7, 2023
  32. geplourde

    geplourde

    Joined:
    May 31, 2017
    Posts:
    23
    Does the gameobject that the Dynamic bone is attached to matter? it seems when I place the component on my jetski (which has the rigidbody movement), the inertia has an effect. If I place on my character which is a child of the jetski, inertia seems to be ignored from the jetski's movements. And the rotational force seems to be changing as well.


    Is there any sample scenes using bones and rigidbody physics? Specifically, a bone attached to a character, which is a child of a rigidbody? I think an example would be good to get me in the right place. Alot of questions currently.
     
  33. geplourde

    geplourde

    Joined:
    May 31, 2017
    Posts:
    23
    Also, what is the point of the 'Reference Object' parameter? I can't find any information on it in the readMe.
     
  34. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    1. 'Inertia' parameter doesn't account for character rotation, only position is considered.
    2. Gameobject that the Dynamic bone is attached matters. Dynamic Bone detect gameObject's movement depend on gameObject it attached.
    3. 'Reference Object' is for "Distant Disable" functionality. Dynamic Bone disable physics simulation automatically if it is far from camera or Reference Object.

    You can send the test unity project to willhongcom@gmail.com
    I'll try to figure out the better settings.
     
  35. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hello. My dynamic bone has over 20+ children that I don't want affected. So I need to add these many children to the exclude list, but every time I modify the prefab and add more, I have to remember to add them to the exclude list. This is kinda troublesome to upkeep. Is it possible to have the opposite? and just define the one root bone to be dynamic?
     
  36. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    130
    Ignore the "root" bone of the ones you want ignored.

    For example:

    Bone 1 (Normal)
    --> Bone 2 (Dynamic)
    ----> Bone 3 (Ignored)
    all the bones after this will also be ignored.
     
    Will-Hong and Dobalina like this.
  37. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Thanks! That seemed to solve it.
     
  38. magebuzzcutt

    magebuzzcutt

    Joined:
    Jun 20, 2021
    Posts:
    17
    hi, is there a way to change exclusions and roots during runtime? thanks in advanced
     
  39. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    30
    Yes,
    you need to call SetupParticles() after change.