Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Dynamic Bone - Realistic swaying ponytail and bouncing boobs

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

  1. SureSight

    SureSight

    Joined:
    Aug 2, 2013
    Posts:
    64
    How would the bones approach change if breasts used blend shapes to alter size/shape?
    Altering the Dynamic Bone setting is easy enough, but what other considerations are there?
     
  2. AKQJ10

    AKQJ10

    Joined:
    Feb 9, 2012
    Posts:
    33
    @HorngYuiWei Thanks a lot for making this great tool. In the demo scene (player with boob and tail), when playing the animation, change the value of gravity on the tail dynamic bone will change the behavior. But when it's not playing animation, (player just keep the idle pose), change the value of gravity on the tail dynamic bone has no effect at all. I want a bigger gravity value to make the tail stay closer to the ground, a smaller gravity value will make the tail stay higher, a positive gravity y_value will make it even higher. Just like what happened in the case of change gravity value when playing animation. I also manually drag the player (in idle) GameObject in Unity scene view, and the tail did swing around, but showed no difference with different gravity values. If I remove force -= pf; in the function of
    void UpdateParticles1()
    {
    Vector3 force = m_Gravity;
    Vector3 fdir = m_Gravity.normalized;
    Vector3 rf = m_Root.TransformDirection(m_LocalGravity);
    Vector3 pf = fdir * Mathf.Max(Vector3.Dot(rf, fdir), 0); // project current gravity to rest gravity
    force -= pf; // remove projected gravity
    force = (force + m_Force) * m_ObjectScale;
    ......
    }
    It works for idle case(no animation), but it messed up the gravity of the tail when playing animation?
     
  3. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    I'm working on a new version which can change parameters at runtime.
    Please email to willhongcom@gmail.com for more info.

    你好,请mail到willhongcom@gmail.com索取开发中版本,可以动态改变参数。
     
    SureSight and hopeful like this.
  4. AKQJ10

    AKQJ10

    Joined:
    Feb 9, 2012
    Posts:
    33
    I have just sent an email via junqian2015@foxmail.com. Thanks a lot. :)
     
  5. LAiKA787SV

    LAiKA787SV

    Joined:
    May 6, 2011
    Posts:
    61

    Hello,

    Will there be a Friction adjustment function on future ? I think I can solve my skirt problem by adjusting Friction. So far I just adjust Update Rate, Elasticity, and Inert. It works, but still not the best.

    Like making them not to slide off easily.

    If there are way to adjust collider's friction, I think that's nice ^^
     
    Last edited: May 6, 2017
  6. borderlineinteractive

    borderlineinteractive

    Joined:
    Sep 20, 2015
    Posts:
    14
    Is it possible to add a collider via script? I am using this code:

    dynamicBones [bone_count].m_Colliders.Add (dynamic_bone_collider);

    but get this error:

    NullReferenceException: Object reference not set to an instance of an object
    my_script.Update () (at Assets/scripts/my_script.cs:1001)

    dynamicBones is an array of Dynamic Bones retrieved via GetComponents

    dynamicBones = gameObject.GetComponents<DynamicBone> ();

    dynamic_bone_collider is a DynamicBoneCollider assigned in the editor

    public DynamicBoneCollider dynamic_bone_collider;

    is m_Colliders not accessible via script?
     
  7. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174

    Hi,
    please check is m_Colliders null.
    If it's null, you need to new a list before use it.

    Will Hong
     
  8. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    you can use "enabled" to enable/disable Dynamic Bone.
    or "SetWeight()" function to control how Dynamic Bone blend with existing animation.

    Will Hong
     
  9. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hey, wondered if there are future plans? I am looking at trying this asset out :)
     
  10. NoiseFloorDev

    NoiseFloorDev

    Joined:
    May 13, 2017
    Posts:
    104
    Neat script. It's simple enough that it's pretty straightforward to modify., which is nice. Most physics systems are so complicated they're hard to customize beyond what they already do.

    One limitation I've run into is the way elasticity/stiffness work: they make the particles want to approach their original position. This tends to cause weird bends in the joint chain. For example (describing it in 2D):


    Blue is the original orientation, and joint C has some stiffness. When joint A rotates down (green), the stiffness makes joint C want to go back to its original position at C1, giving a weird angle at B. Stiffness makes joints move linearly towards their original position. This becomes noticeable if you have several joints, add some gravity and put stiffness high (but not 100%).

    It seems like what I really want is to be able to have joint B retain its *angle* relative to A and C, so it tries to retain its 90-degree bend. When joint A rotates down, either B or C would move in order to retain that angle.

    I've tried various things, but haven't had much luck. Maybe it's just hard to do with a particle-based sim where the particles themselves have no orientation, but maybe there's a simple way to do it.
     
  11. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  12. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Dynamic Bone is still supported.
    Bug fix and new features are in working.
    you can send mail to willhongcom@gmail.com to request evaluation version.

    Will Hong
     
  13. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    I tried how elasticity working as you said before. but it does not look as good as it is now and needs more computation.
    maybe I'll add the option in future release.

    Will Hong
     
  14. NoiseFloorDev

    NoiseFloorDev

    Joined:
    May 13, 2017
    Posts:
    104
    I see odd effects from it. I think I have angular stiffness working. Here's a video to compare:

    https://s3.amazonaws.com/noisefloordev/2017-07-03+15-48-04.mp4

    Blue is the original, green is angular. First this shows a simple three-joint chain, with one joint stiff (elastic--not really clear on what "stiffness" actually does compared to elastic). Notice how the original (blue) changes angle and bends the wrong way, because the joint is trying to reach its original position. With the angular version, it stays correct.

    Next, it shows a bigger chain, with an elasticity curve across the chain. When I turn it on, blue (original) never settles and remains floating halfway, and gravitates in that direction when it moves. The angular version settles normally (for a straight chain--it still won't settle around the center of gravity, of course). This one behaves more intuitively, with each joint maintaining the angle relative to its parents. (Actually, each joint moves to maintain the grandparent->parent->self angle.) If I remove the elasticity curve, it'll still orient towards the original shape like you'd want for animation-controlled dynamics.

    Not very well tested yet, but it seems promising...
     
    HorngYuiWei likes this.
  15. NoiseFloorDev

    NoiseFloorDev

    Joined:
    May 13, 2017
    Posts:
    104
    It took a while to figure out how DynamicBone interacts with animation. For anyone wondering:

    - In Update (or FixedUpdate), it resets joints to their original positions.
    - Animator runs, and puts any animated joints in their animated position.
    - In LateUpdate (regardless of update mode), DynamicBone runs dynamics, using the current joint position as the rest position. If you set elasticity and have an animation, elasticity will move towards the animated position instead of the original position.

    Note that it always updates in LateUpdate, even in "physics" mode, and always in game time (not physics time), so "Animate Physics" doesn't quite work. For example, set physics to 1 FPS (Settings -> Time -> Fixed Timestemp = 1) and put Animator and DynamicBone in "Animate physics". Your animation will run at 1 FPS, but DynamicBone will still update at 60 FPS and it won't follow the animation (instead it'll jump around oddly).

    That's fixable, but I don't want to make my animations run at physics FPS anyway. I want animations to run smoothly at display FPS. I changed this around to work differently. I have two identical joint chains, one for dynamics, and one for animation, with the mesh skinned to the dynamics copy. DynamicBone matches up animation joints for each dynamics joint, and uses that as the target. This works pretty nicely. It decouples animation and physics, I can run DynamicJoints as a fixed physics update (if I want to) and Animator as a normal update, I don't need to reset joint positions early, and SkipUpdateParticles is no longer needed. It's also easier to test, since I can move the animation joints directly. (This is the way this sort of thing is done in Maya.)

    It's not perfect since I haven't found a good way to match up joints in two chains, since Unity's FBX importer renames nodes for no apparent reason. (Grr, this was reported by somebody half a decade ago and was ignored...) Right now I'm assuming single joint chains and just matching single children since that's all I'm doing right now.
     
  16. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Animator now has good API for modifying bone positions with rich data and better performance though, but I'm guessing that's not really an issue here. The API also helps with a proper integration (it was intended for ik and physics).
     
  17. NoiseFloorDev

    NoiseFloorDev

    Joined:
    May 13, 2017
    Posts:
    104
    Mind pointing me to it (not sure where to look)? Would be good to take a look at, at least.
     
  18. bonsaisushi

    bonsaisushi

    Joined:
    May 18, 2017
    Posts:
    34
    Would this asset work in non-human models? I want to animate a spider (for example), is this suited for that?
     
  19. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Dynamic Bone works on any transform hierarchy.
    If you are not sure is it work in your project. Please send mail to willhongcom@gmail.com to request evaluation version.

    Will Hong
     
  20. lonvoen

    lonvoen

    Joined:
    Jan 3, 2013
    Posts:
    1
    I'm likely overlooking something simple, but this seems to not allow me to move the root transform's position even while the game is not running. Attempting to disable the script or gameobject does not work either, as they snap back into place as soon as the scene view is updated. Any help?
     
  21. betaFlux

    betaFlux

    Joined:
    Jan 7, 2013
    Posts:
    110
    Hi, I have a problem with the bone settings. I start play mode and set the physics to my liking, copy component, and then paste the component values in editor time. When I start play mode again, all settings seem to have no effect, the physics behave like before the changes were made, but the inspector values are showing the changes.

    In play mode I have to move i.e. the damping slider a little for it to have the desired effect.

    Is this a known issue?
     
  22. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Copy past component values should work as any other components.
    If you need to change parameters at runtime by script.
    You can call UpdateParameters() after modify any parameter.
     
  23. cjacobwade

    cjacobwade

    Joined:
    Jun 8, 2013
    Posts:
    9
    Feature change request: rather than specifying freeze axis as the plane to move along, it would be nice to have a bitmask and specify which (1 or 2 or 3) axes to move along.
     
  24. J_hammer

    J_hammer

    Joined:
    Aug 8, 2017
    Posts:
    2
    @HorngYuiWei Hi there, we just purchased the software and the results are great! However the one issue we seem to be having is the Gravity of the blue rope not acting as expected.
    Provided the small block stays relatively upright, the jiggle physics work fine and looks great. The moment we rotate the block past a certain point the blue line stiffens and seems to point towards a central entity rather than using the world space as it's basis for gravity?
    I saw a post earlier in the thread that sounded similar whereby you asked them to use Force instead of Gravity, I'm not getting any changes to the effect.
    The set up is the same as the demo scene, but any further value adjustments to gravity and or force yield undesirable results.
    Any thought's on what might be causing it to act this way?

    ropeconfusion.jpg
     
  25. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    "Force" should apply force in world space.
    Please send a test file to willhongcom@gmail.com. I'll look into it.

    Will Hong
     
  26. J_hammer

    J_hammer

    Joined:
    Aug 8, 2017
    Posts:
    2
    Hi Will, just to let you know, I got it working.
    Force does indeed do the trick, however I had Elasticity on it which was blocking the behaviour. So a silly mistake on my part but it's all good now:) Thanks.
     
  27. minad2017

    minad2017

    Joined:
    Dec 1, 2016
    Posts:
    50
    I'd like to shake the hair of a character naturally in a moving car, but can it be realized with this asset?
    When the character gets on the car, I want to solve the problem that the hair moves according to the movement of the car.
     
  28. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    You can send mail to willhongcom@gmail.com to request evaluation version.

    Will Hong
     
  29. minad2017

    minad2017

    Joined:
    Dec 1, 2016
    Posts:
    50
    hi,
    I already purchased "Dynamic bone asset".
    However, knowledge was scarce and I did not know how to realize it.
     
  30. Jazneo

    Jazneo

    Joined:
    May 25, 2017
    Posts:
    1
    I was a wonder if be able to add a feature it automatically set to the bone when you put the dynamic bone script on the bone? It would make it faster add Dyanimic bone on hair and skirt etc.
     
  31. evilangel89

    evilangel89

    Joined:
    Feb 8, 2017
    Posts:
    269
    Hi Will,

    Sorry if this has already been asked. But I am trying to give a realistic look to a zip line (basically what I have right now is a straight line between two points) by trying to have it sway, currently it's a flat straight line mesh. Can dynamic bone help me achieve this ?

    Regards,
    Tharindu
     
  32. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Dynamic Bone can have only one fixed end point.
    You may need other rope solution or use Unity's physics to achieve this.

    Will Hong
     
    hopeful likes this.
  33. nilrith

    nilrith

    Joined:
    Oct 1, 2016
    Posts:
    5
    hi horngYuiWei, i have problem when using dynamic bone in unity slow motion (TimeScale). is it possible to smooth on timeScale?
     
    jihedovsky likes this.
  34. LinqToThePast

    LinqToThePast

    Joined:
    Jul 22, 2017
    Posts:
    2
    Hi HorngYuiWei!

    I'm having a small issue with DynamicBoneCollider in 2017.1 - when I add collider references to the DynamicBone component from a DynamicBoneCollider attached to a prefab, the references never update to use the instantiated prefab at run-time; they still only reference the prefab sat in the project folder. I'm happy enough to try and populate the references to the colliders at runtime but seems like strange behavior to me - is this how the collider references are meant to work?
     
  35. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    the colliders should reference to correct one.
    You can send a test file to willhongcom@gmail.com, I'll look into it.

    Will Hong
     
    LinqToThePast likes this.
  36. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Dynamic Bone updates in fixed rate.
    It's a know issue in slow motion.
     
  37. Kin0min

    Kin0min

    Joined:
    May 12, 2015
    Posts:
    8
    Hi @HorngYuiWei, I've been having a problem with IK (Final IK) causing severe shaking with Dynamic Bone:
    https://webmshare.com/play/QP6ba

    I've tried adjusting settings numerous times but only disabling the script or IK, or turning stiffness all the way to 1 stops the shaking.
     
  38. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Dynamic Bone should work well with Final IK.
    Use Unity's "Edit->Project Settings->Script Execution Order" functionality.
    Add both Dynamic Bone and Final IK scripts to the Mono Manager dialog.
    Let Dynamic Bone execute after Final IK.

    Will Hong
     
  39. Kin0min

    Kin0min

    Joined:
    May 12, 2015
    Posts:
    8
    Thank you very much for your reply, that worked perfectly.
     
    hopeful likes this.
  40. D-Coy

    D-Coy

    Joined:
    Jun 2, 2013
    Posts:
    16
    Love this tool, very versatile.

    Also in need of a Friction parameter. Wondering if this might be included in a future version.

    Cheers
     
  41. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    I'm experiment with friction, please mail to willhongcom@gmaill.com
    I'll send you a version.

    Will Hong
     
    hopeful likes this.
  42. Ranocchio

    Ranocchio

    Joined:
    Apr 25, 2017
    Posts:
    6
    Hello HorngYuiWei,

    I recently purchased dynamic bone and I noticed in most of the scripts there are preprocessor conditionals that say
    #if UNITY_5
    code, etc.
    #endif

    Now that the latest version is Unity 2017 perhaps you should update this to be unity 5 and newer so that people who don't know to change this themselves can still access tool tips and the other code placed here.
     
  43. Sword111

    Sword111

    Joined:
    Feb 28, 2016
    Posts:
    18
    HI I'm wondering if I could use this as a bendy sword blade where tip bends proportionately on a collider avatar like this but better ? . Best H
     
    Last edited: Nov 22, 2017
  44. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Dynamic Bone should simulate bendy sword well when it's moving.
    But when collide with avatar, it will not bends proportionately as expected.
     
  45. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Thansk for suggestion.
    I'll update it in next release.
     
  46. Sword111

    Sword111

    Joined:
    Feb 28, 2016
    Posts:
    18
    Thanks for your reply, my flexi blade physics rely on swap out substitute animation on the hit, will your system look better than my flexi physics blade ? Thanks
     
  47. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    you can mail to willhongcom@gmail.com to request evaluation version.
     
  48. Douwert

    Douwert

    Joined:
    Jan 20, 2017
    Posts:
    1
    Hello, I'm very happy with my purchase and you have done a great job. But I have a problem, I'm trying to make this hat dynamic and it works pretty good. I added 150 gravity to the Y axis, but as soon as I rotate it in the Y axis is freezes and doesn't work anymore.

    Could someone help me with this?

    Some gifs to show what I have and mean:
    https://i.imgur.com/IRt6dUu.png
    https://i.imgur.com/9whehXy.gifv
     
  49. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    Try a small negetive gravity value.
    in Unity, positive value in Y axis is up.
     
  50. ars1koz_unity

    ars1koz_unity

    Joined:
    Dec 25, 2017
    Posts:
    3
    Very good project!