Making Havok ragdolls in Blender

From Nexus Mods Wiki
Jump to: navigation, search



I wrote this tutorial because I did not find any tutorials on making this type of item specifically for oblivion, fo3, or fnv.

I recently found this tutorial on making a creature skeleton in blender and it has a similar process. Blender Custom Creature tutorial on CS wiki

Although it is probably considered an advanced guide, it includes clear illustrations and i hope you do not hesitate to try it out!

The tutorial follows along as i am making a new armature for my toy sock snake.

I have added yellow and pink highlights to the screenshots to help you find where in the interface you need to click.

The entire project as shown was done in Blender2.49b

Tools required

Blender 2.49b and Niftools software


Understanding of how to [create custom armors and clothing for Fallout 3] or [Oblivion] in [Blender]. Basic [nifskoping], and understanding how to get stuff you make into the game.

Adding the armature

Adding the armature

I recommend to create the mesh first and build the armature to fit it. It is a good idea to change drawtype of your mesh to wire so you can see what you are doing.

With your 3d cursor positioned at xyz000 add an armature to the scene. With the new armature selected Change the name to "Scene Root" and set deform options to vertex groups.

I dont know if display options matters, i just set mine to stick.

Adding bone segments

Select the tip of the bone segment and extrude it to make another segment. I am extruding mine by .8 along z axis for the main body and made 2 small segments for the tongue.

Name the bones

Then go through and select each bone segment and rename it to something like "Bone01" etc. This will be the name of the vertex groups when you rig your mesh. If your model has x axis symmetry you can append .R and .L to the bones in symmetrical areas and take advantage of x mirroring during weightpainting.

Adding the collision

Now its time to add the collision shapes to the skeleton. I am using cylinders which will turn into bhkcapsuleshape when exported.

This is the same kind of collision mesh used regularly in vanilla skeletons.

Make a collision mesh

Add a cylinder to the scene and position it at the middle of one bone segment using shift s once to snap the 3d cursor to a bone segment with it selected in edit mode, and again to snap selected objects to the cursor.

This will become a capsule shape so think about how close you want them together and how big you want them when doing this.

Change drawtype to bounds and draw extra to wire, go into the logic tab and select bounds, and cylinder.

Then add property of type string called "Havok Material".

Set the string data to be one of the havok materials listed in nif.xml located in your Blender Foundation\Blender\.blender\scripts\bpymodules\pyffi\formats\nif\nifxml\ folder.


Now duplicate the collision mesh and position one of them for each bone segment. It is handy to use the 3d cursor by selecting the bone segment in edit mode, shift s snap cursor to selection, then selecting the duplicated collision object in object mode, shift s snap selection to cursor. then scale the collision objects as desired.

Before rotating the collision meshes you need to select all and hit control a to apply scale and rotation to object data!

Rotate the collision objects as desired. Do not apply scale and rotation on any collision mesh after its rotated.

Parent to each bone

Now you need to parent the collision meshes to the armature. Select the armature and go into pose mode, then select the collision mesh and holding shift, click on the armature so you have the collision mesh and the bone segment selected. hit control p and make parent to bone.

Adding constraints

Add constraints

After you have all of them parented then add constraints to each collision object parented to a child bone. You will not need a constraint on the collision object for Bone01 because it is not a child of any other bone. Select the parent collision object, hold shift and select the child collision object and click the add constraint button and choose rigid body joint.

The exporter scripts can export both ball and hinge rigid body joint constraints but not the generic 6 dof one.

I have not tried exporting a hinge or any other types but the ball one creates a bhkMalleableConstraint block and those are a versatile type that can be used as either a limited hinge or ragdoll constraint.

Positioning the pivots

Click on the ShowPivot button to make axes appear for the hinge. Use pivot x y and z settings to set the location of the pivot right between the bone segments. You will also want to use the Ax XYZ settings to the right to rotate the pivot so the z axis points down along its bone. I dont think you can set all the rest of the settings for the constraint in blender, so when you want to alter friction or range of motion do so in nifskope. Please refer to this excellent guide on doing it. Oblivion Bhk Constraints

It is not easy to get the pivots positioned exactly by hand but I was happy to find that a script was written by SigTerm. pivot script by SigTerm Copy this script and paste it into an editor that will accept code formatting such as notepad++. Make a folder \Blender Foundation\Blender\.blender\scripts\animation and save it in there with a .py extension. To use it, right click on the border of 2 windows and add a new one and select scripts window. select the armature and enter pose mode, select a child bone and hit shift-s to snap the 3d cursor to the selection. Select the collision mesh parented to the same bone. It will put you into object mode and now you can run the script.

Skinning your mesh


Once all constraint pivots are in place it is time to skin your mesh to the new armature! Grab your mesh, parent it to Scene Root (the armature you made)by selecting it and shift selecting the armature and hitting control p or just typing "Scene Root" into the box where it says "Par:".

If you have a complicated mesh it will be hard to weightpaint. It is a good idea to create a simple mesh in the general shape of your complicated one and weightpaint that one instead. You can subdivide it after weightpainting to make blender automatically create a weight gradient along the subdivisions and then use the bone weight copy script to transfer the weights onto each vertex of the complicated mesh.

Now go into weight paint mode. Click on the new button under vertex groups and type in the name of a bone segment. Create a new vertex group for each bone in the armature.

It is good to use the weightpainting mask to control where you are painting on, the mix brush is the easiest to use cause you can just set the desired maximum weight and it will either increase or decrease bone influence to meet your setting. Also try using the weight gradient script in paint > weight gradient. You want to have a smooth gradient over the pivots you set earlier.

Looking good!

You can test your weights by selecting the armature and going into pose mode. rotate the bone segments to see how it deforms the mesh. After you are done testing it, hit w and select clear user transform to reset the armature back to its original state. Now when all that is finished and you have your mesh all done with uv maps and material and everything just like any clothing item, its time to export.


Export settings

You need to have everything selected when you export, select Fallout or Oblivion defaults then turn off flatten skin, turn on clutter havok presets and choose the material you decided to use. Turn on shader presets for cloth. Turn on use bsfadenode and turn off export dismember body parts. Once exported, you can put it into your testing folder and open it with geck and turn on the havok sim to see how it is working.

Finishing up

Geck Havok sim

As suggested earlier you may want to tweak the havok and constraint settings in nifskope. Here is a picture of the snake I made running in the geck havok simulation. It may take some experimentation to get the type of movement you are after but the havok settings in nif.xml is pretty well documented and the constraints tutorial I mentioned should be all you need.

I hope this helps you add an extra bit of fun to your mods!