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.

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
  2. esperecyan

    esperecyan

    Joined:
    Mar 6, 2018
    Posts:
    1
    Could you please add asmdef (Assembly Definition)? I am releasing the Editor Extension for VRChat with UPM, and I am having to write some strange code to prevent reference errors with and without DynamicBone. Also, if an user is manually adding asmdefs, Type.GetType("DynamicBone, Assembly-CSharp") will return null, so I cannot support them currently.
     
    HorngYuiWei likes this.
  3. turnstyle

    turnstyle

    Joined:
    Jan 20, 2014
    Posts:
    3
    Great dynamic system! I'm having trouble seeing the weight blending - can anyone here confirm that its working in the latest version?
     
  4. HorngYuiWei

    HorngYuiWei

    Joined:
    Apr 27, 2014
    Posts:
    174
    Hi,
    please give more detail what problem you meet.
    You can also mail to willhongcom@gmail.com for support.
     
  5. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    648
    I'm experiencing a lot of jank the first few seconds the rig is enabled for the first time. Is there a way to prewarm the physics simulation for disabled objects? Or to smooth it out when enabling the rig?
     
  6. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    The jank is caused by unstable frame rate mostly.
    you can enable/disable Dynamic Bone component or set "m_BlendWeight" parameter in the first few secondes.
     
  7. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    648
    I solved the above issue but I have a new one. Physics in build behave a lot differently than they do in the editor with the Default update mode and the default update rate of 60. This seems to be a refresh rate dependent issue. Build remains consistent with the editor if my monitor is set to 144hz. But if I set my monitor's refresh rate to 60hz, nothing changes in the editor, it's still the same as 144hz version but build's physics are going nuts at 60hz monitor refresh rate. I'm not sure where the issue is since the update rate is 60 in both configurations of the monitor.

    EDIT: Solved by switching from Default update mode to Normal, which I assume normalizes physics simulation across different refresh rates.
     
    Last edited: May 3, 2022
    Will-Hong likes this.
  8. turnstyle

    turnstyle

    Joined:
    Jan 20, 2014
    Posts:
    3
    Is your EDIT how you solved the above issue of Jank?
     
  9. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    648
    My use case is probably pretty niche. I use dynamic bone on EsotericSoftware's Spine rigs skeletons spawned by the SkeletonUtility component that ships with the official Spine Unity runtimes. The project has a sort of universal Spine character rig that's reused and has many different starting poses that are baked in animations. So the jank came from the skeleton initializing in the setup pose and then immediately applying the pose of its newly applied animation in the same frame causing a lot of "movement".

    So I simply disabled physics by default via setting the m_BlendWeight to 0 as suggested above. And when the rig is enabled, I wait a frame, then over 10 frames I slowly ramp up m_BlendWeight to the value of 1. This seems to have eliminated the jank I experienced with enabling skeletons and changing their poses.
     
    Will-Hong likes this.
  10. turnstyle

    turnstyle

    Joined:
    Jan 20, 2014
    Posts:
    3
    Thanks for explaining that. I'm doing something similar with controlling the m_blendweight via a joint in the animation that translates in Y direction 0-100. This way I can craft some poses of capes and such to turn the dynamics on and off within an anim. What happens for me is as soon as they are spawned on camera I think the particles reset even though my blendweight is at 0 and there is a flutter then it holds steady.
    Another problem is when I pick up that character and move them the cape drifts and I wish it stayed at blendweight of zero.
     
  11. NexonVision

    NexonVision

    Joined:
    Aug 30, 2018
    Posts:
    6
    for some reason adding any gravity or force will make the bones less bouncy and what not. is this expected behavior?
     
  12. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    Gravity or force add movement to bones each frame. if the values are large, it may overide other physics simulation results.
     
  13. kira_unity704

    kira_unity704

    Joined:
    May 18, 2022
    Posts:
    1
    Hi There. I have Dynamic Bone. Can it be used to prevent self-collision. For example, we are doing mocap and the characters hands will go through their thighs. Can I use dynamic bone to prevent that and instead hand rests on thigh
     
  14. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    Dynamic Bone has it's own colliders. You can apply dynamic bone to hair and add colliders to head.
    So hair will not penetrate into head.
    It's may not usefull in your situation.
     
  15. 3uhox

    3uhox

    Joined:
    Jun 4, 2011
    Posts:
    61
    Hello, I'm getting this error with an animated character (set to Generic)
    Code (CSharp):
    1. MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. UnityEngine.Transform.set_localPosition (UnityEngine.Vector3 value) (at <40205bb2cb25478a9cb0f5e54cf11441>:0)
    4. DynamicBone.InitTransforms (DynamicBone+ParticleTree pt) (at Assets/DynamicBone/Scripts/DynamicBone.cs:730)
    5. DynamicBone.InitTransforms () (at Assets/DynamicBone/Scripts/DynamicBone.cs:719)
    6. DynamicBone.PreUpdate () (at Assets/DynamicBone/Scripts/DynamicBone.cs:333)
    7. DynamicBone.Update () (at Assets/DynamicBone/Scripts/DynamicBone.cs:214)
    8.  
    I can't tell what triggers it, it seems to happen when the game object enters the screen
     
  16. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    It seems some gameobjects in dynamic bone hierarchy are removed.
     
  17. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    129
    Hey, so ive been trying to trouble shoot why my NPC system is lagging, and ive finally narrowed it down to the DynamicBones I have in their hierarchy. There's about 50-60 bones per NPC, and i was wondering what the maximum amount of DynamicBones in a scene is reccomended/ most performant.

    Is it more reccommended for just a single character, like the player, or is there a way to optimize it for dozens of characters? I've been testing with about 25 NPCs per scene
     
  18. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    Performance depend on a lot of factors. there is no general recommandation.
    You can try use "Distant Disable" feature to disable dynamic bones far from camera automatically.
     
  19. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    129
    Ah okay ill try that. Looks like with 25 NPCs i get about 700 dynamic bones causing -30fps drops
     
  20. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    34
    Hi, wonderful asset, but I am wondering if it is possible to add a relative velocity to Dynamic Bone. For example, I don't want the hair bones to react to character movement; I only want them to move if the character rotates their head. How can I implement a relative velocity that I can set at runtime, so that Dynamic Bone subtracts this velocity when it calculates the particle movements? Which part of the code should I be looking at?

    Thanks a lot! :)
     
  21. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    Increase "Inert" parameter should be helpful.
     
  22. TigerHix

    TigerHix

    Joined:
    Oct 20, 2015
    Posts:
    34
    I tried, but increasing inert all the way to 1 still makes the bones move too much of my liking, especially if my character's world position moves super fast (i.e. on a car).

    EDIT: Never mind, I found out that my inert distribution was set to a custom curve, and resetting the curve made the bones stop moving completely. However, I am still wondering if there is a more direct way to offset a velocity for all particle movements :confused:
     
    Last edited: May 26, 2022
  23. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    You can try set "Force" parameter. The value is added to bones every frame.
     
  24. Noiracide

    Noiracide

    Joined:
    Dec 26, 2016
    Posts:
    1
    Hello Will-Hong ! I purchased your Dynamic Bones asset and I want to add a component script that add a sinusoidal wind force to my armature, but with a very little force added , my bones are completely bent !
    What is the specification of the wind force and how I can achieve a wind force correctly with your asset ?
    Thanks !

     
  25. Will-Hong

    Will-Hong

    Joined:
    Apr 17, 2014
    Posts:
    8
    "Force" values are added to each bones every frame.
    You can try smaller values.
     
unityunity