How to make a nif with multiple collision materials

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

For this tutorial you will need:

  • A nif with your model
  • A nif of a mesh for your collision mesh that is saved as a non-collision mesh
  • NifSkope 1.0.14 or later (in order to find the names for certain items in NifSkope)


File:MultColMat01.JPG
Final version of CleanedCollision.nif

The first thing to do is open up ARStatue01.nif from the \Dungeons\AyleidRuins\Exterior folder in NifSkope. Next, remove all of the NiTriStrips (right-click > Block >Remove Branch or highlight the block and then Ctrl+Del). Once they are removed, expand all of the branches in the bhkCollisionObject and remove the NiTriStripsData block. Once you are done with that, your nif should now look like the thumbnail to the right. Then save the nif file as CleanCollision.nif so that it can be used later for other nifs.

File:MultColMat02.JPG
NiTriStripsData to be copied

Next, open up the mesh that you will be using for your collision mesh and expand all of the NiTriStrips. In each one, there is a NiTriStripsData branch which you need to copy one by one and paste into your CleanCollision.nif file.

NOTE: Make sure that you know which material each of these NiTriStripsData corresponds to as it will be needed later on in the process.

File:MultColMat03.JPG
Adding NiTriStripsData and Changing values

Then you want to go to the bhkNiTriStripsShape and change the Num Strips Data and Num Data Layers values to match the number of NiTriStripsData branches you pasted in (in this case 4) as seen in the thumbnail to the right.

File:MultColMat04.JPG
Updating Strips Data and Data Layers - Adjusting Subkeys

Once those are changed, you need to update the Strips Data and Data Layers (right-click > Array > Update or left-click the circling arrows) and then expand the Strips Data and Data Layers. Enter the numbers for each of the NiTriStripsData into one of the Strips Data subkeys and make sure that each Layer in the Data Layers subkeys is set to OL_STATIC.

File:MultColMat05.JPG
Making bhkPackedNiTriStripsShape - Updating values

Next go to the bhkNiTriStripsShape and pack the strips (right-click > Havok > Pack Strips) to create the bhkPackedNiTriStripsShape that will replace the bhkNiTriStripsShape and which is also moved to the bottom of your NiNode. At this point, you need to determine the number of Sub Shapes needed for your mesh (one of the meshes I exported split into 3 sections, so I only need 2 SubShapes) and set the Num Sub Shapes to that value and then update the Sub Shapes (right-click > Array > Update or left-click the circling arrows) directly under it. Expand the Sub Shapes and make sure that your Layer is set to OL_STATIC and set the Material in each to the appropriate havok material.


Then go to the bhkNiTriStripsShape that was replaced and moved to the bottom of the NiNode, expand it, and get the Num Vertices value for all of the NiTriStripsData entries. Take these values and place them into the Num Vertices values of the Sub Shapes subkeys making sure that you follow the order of the NiTriStripsData (mine just happened to be 60 and 60).

File:MultColMat08.JPG
Updating Scales for Havok

Next, delete the bhkNiTriStripsShape, go to the bhkPackedNiTriStripsShape and change Scale Copy? and Scale to 1 (XYZ should all be 1).

File:MultColMat09.JPG
Finalized Nif

Open the nif containing your model and copy each of the NiTriStrips (and anything else needed) into the nif that you have been working on. On the top menu, select Spells > Batch > Update All Tangent Spaces and then Spells > Sanitize > Reorder Blocks. Once that is done, save the nif you have been building under a new name and you are finished.

Open the Construction Set, drop your new model into the world, launch Oblivion, go shoot arrows at your model, and you will see and hear your arrows ricochet off stone, clink against glass or metal and stick in wood with the appropriate sounds.


Note: If your model is a building, make a simplified version of it with lower resolution textures for a Visible-When-Distant version, which doesn't need collision since the player will never be near it. If your building is called MyHouse.nif, then name the Visible-When-Distant version MyHouse_far.nif. In the Construction Set, click on the model and tick the Visible When Distant box. Additionally, you need Oblivion Mod Manager to change the Load Order of your Mod, putting yours at the top to load first if you want to see modified Visible-When-Distant objects, until another way is finally figured out.