What are Dangle Bones, and how do they work?
Created by @eagul Published March 20 2023
This guide will teach you everything you need to know about dangle bones, focussing mostly on hair meshes. However, dangle bones can also be applied to any other mesh
Assumed skill level: - You are familiar with Wolvenkit and Blender. - You know what bones and weights are. - You are able to read and comprehend instructions.
Dangle bones are a 'chain' of linked bones which are used by the game engine to simulate physics (dangle). They're found mostly in hairs, but also in certain clothing items. For a mesh to have working dangle physics, corresponding .rig and .animgraph files are also needed The image below depicts how a dangle skeleton looks. The .animgraph will move the dangle bone chains, which are connected to the mesh using weights, which will then in turn animate the mesh.
The easiest way to add physics to a mesh that does not have them, is to transfer them from another mesh. If you are doing a hair port, prepare the (static) .mesh and textures first. 1) Locate a 'donor' mesh. It should have a similar mesh, and physics that you could also see working on your 'new' mesh. 2) Add both the donor mesh, together with it's .rig and .animgraph pair, and your new mesh to the project in wolvenkit. 3) Import both meshes to blender. 4) Using alt+P, clear the parent of the new mesh. Now select the new mesh, and then the armature of the donor mesh, and press ctrl+P, followed by Armature Deform with Empty Groups. 5) Select the donor mesh, and secondly the new mesh. Swap to weight paint mode. In the top-left cornet, press 'weights' and then 'transfer weights'. In the bottom-left corner, a small black window will appear. Click it. Set Vertex Mapping to nearest face interpolated, and source layers to 'by name' 6) Go into weight paint mode and manually clean up the weights, using the weight transfer as a reference. Optionally duplicate the mesh and move the copy to the side, so you keep an untouched reference. 7) Import it back into wolvenkit, and you're done!
1) Oftentimes, you can get away with editing a hair mesh, and not having to touch the physics at all, especially if the changes you are making are fairly small. 2) If you move the mesh away from the bones, it might move in unexpected ways. The further the mesh is from the bone, the more of a 'lever' effect will happen. This is particularly noticable when bones are rotating around an axis perpendicular to the one you moved the mesh away on. Usually small movements are fine and will not affect the dangles in a noticably bad way. If you do find yourself in a situation where you need to move the skeleton as well, check the 'Moving a Dangle Chain' section. 3) Check out UUH4V. It's an amazing resource that will allow you to load multiple hair meshes with each their own rig/anim pair simultanously. Keep in mind that you cannot have 2 of the same rig/anim pair loaded in the same hair slot simultanously, as this will cause unacceptable deforms. You need to merge any 2 meshes that use the same rig/anim pair in blender and import them as one .mesh.
Included is an image of what i mean by the leverage effect. I used a handy little trick here to make bones visible in-game. Overlay a simple mesh over each of the bones in blender and weight paint it completely red. Load the boxes instead of a hair mesh. Edit the material used by the mesh to make it better visible. I used plastic_red here. Congratulations, you can now clearly see what bones are doing in-game. Hiding the body mesh helps with visibility. Green circle includes the true location of the dangle bone chain. Meshes in the yellow circle are rigged to the same bones as those in the green circle. Bone 3 is invisible. Upon moving bone 3 to the right (by editing the .rig), bone/mesh 1 rotated slightly, making mesh 2 do a huge leap. If you were to load a hair mesh in the same location as indicated by the yellow circle, you would end up with horrible stretching and deformations, even without exxagerating the effect by moving bone 3.
Created: March 20 2023 by @eagul Last documented update: Dec 19 2024 by
This guide will go deep into detail about moving dangle bones. Still unknown: changing bone parenting, rotating bones, editing the animgraph physics, adding new mirrored dangle chains for better coverage. If anyone has done tests on any of these topics, please contact @eagul via Discord!
- You understand what you are doing, and know why you need to move dangle bones - You are able to read and comprehend instructions.
Visual learners, rejoice! Here is a more up do date guide in a video form with some helpful tools as well: https://www.youtube.com/watch?v=kojfyn_6jv4
Okay.... Let's get started. If you are doing physics stuff, and need to move the dangle bones to fix the leverage effect, or for any other reason, you are in the right place. I will be using my long hair dangles project for examples here. Read 'Leverage effect' section in 'Dangle Bones' page for the reasoning behind why this process is necessary. (Using a normal hair dangle skeleton is not an option because it is parented to the 'head' bone, which causes horrible clipping and unnatural movements when the head turns. It might be possible to change the parenting to spine3 bone, but i have yet to test. Even if it is possible, the process described below would still be usefull to move the chains into the right positions) You will need to do a couple things: 1) Get everything into blender. 2) Isolate the bones you need to move. Hide other bones in armature edit mode. 3) Duplicate the bones and move them to the desired position. 4) Edit the bone positions in both the .mesh and .rig, sometimes editing the collision hitboxes in the .animgraph will also be required. I would also recommend having a rigged and weight painted mesh ready, for testing purposes. I will explain each step of the process more in-detail below.
Usually, you can get the skeleton in it's real form into blender by using WithRig export on the mesh. However, if the .mesh contains bones that are not present in the .rig, you will need to use MultiMesh Export. You need to find a second (or even more) .rig file, so all the bones that are present in the mesh have a counterpart in the .rig. You then need to also add the meshes that correspond to the new .rigs and then export. Attached images show settings i used to export base\characters\garment\citizen_formal\torso\t1_072_shirt__netwatch\t1_072_ma_shirt__netwatch_dangle.mesh with rig, which i used for long hair dangles.
Open the .rig file in Wolvenkit. Under boneNames you can find which index corresponds to which bone. Expand boneTransforms. Locate the bones you want to move. Moving a bone in a chain will also move every bone that's parented to it (located lower than it in the chain). In the case of the image above, moving the bone selected in yellow, also moved the entire chain. In this case i moved bone 8 (selected in yellow) by 0.283076668 on the Y axis.
As you can see, the skeleton exploded. This is (to my understanding) caused by collision hitboxes on the spine bones. It will only happen if you have moved the dangle chain inside of those hitboxes. If this happens to your skeleton/mesh, follow these steps to fix it: 1) Open the .animgraph file in Wolvenkit. Expand the 'rootNode' array, and keep expanding untill you see collisionRoundedShape and then lower the roundedCornerRadius for each of the bones untill your skeleton no longer explodes. Here i set the value to 0, the animations work fine, but a correctly set value might reduce clipping in some poses.
Notice how editing the bone positions in the .rig also deformed/moved the mesh in-game. At least it's dangling nicely now, and it no longer explodes :copium:
The .mesh also contains bone matrices. To my understanding, these are used to map the bones from the .rig to the vertices. You will need to move the bones in the .mesh to match the changes You did to the .rig skeleton, and this will fix the mesh deform. In this case, I'm editing bones 79-83. The goal is to move each of them by -0.283076668 on the Y axis. Open the .mesh in Wolvenkit and navigate to boneRigMatrices.
Next, open https://matrixcalc.org/ and copy paste each of the entries of the bone matrix into the calculator. Then press inverse.
Notice how the bottom row of the inverse matrix corresponds to the coordinates of the bone, which you can see in Blender.
Next, copy the new Y coordinate from the bone you duplicated and moved.
After that, return to the calculator, and press 'Insert in B', and then replace the matrix entry corresponding to the Y position of the bone with the new coordinate.
Then, press 'inverse'
Next, press the 3 small lines below the output, click on Show LaTeX, and copy the top row entries back into wolvenkit.
And now repeat all of those steps for each of your bones... enjoy... After that, you should be finished!