Weapons with multiple collision objects

From Nexus Mods Wiki
Revision as of 14:31, 10 January 2011 by LHammonds (talk | contribs) (Created page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

This tutorial will show you how to add simple

Prerequisites

This tutorial assumes the following:

Related items not covered in this tutorial:

Software used in the creation of this tutorial:

  • Blender 2.46
  • Blender NIF Scripts 2.3.3
  • PyFFI 0.10.9
  • NifSkope 1.0.10

Collision model #1

Add a cylinder collision model for the length of the sword (normally the handle and blade)

  1. Place the 3D cursor at 0,0,0 by pressing Shift + C and press 1 to set your view to the Front.
  2. Press SpaceBar --> Add --> Mesh --> Cube
  3. Press F9 (Editing View), change the Mesh (ME) and Object (OB) name from "Cube" to "Cylinder"
  4. Press F7 (Object View), change Drawtype from "Shaded" to "Bounds" and the dropdown under Draw Extra from "Box" to "Cylinder"
  5. Press 3 (Right View), press R, 90, ENTER which will rotate the cylinder 90 degrees and should match the handle fairly close.
  6. Press TAB for edit mode and adjust the edges of the box so they closely cover the handle and possibly even the blade if it is straight enough. Be sure not to deform the box such as only moving one vertex...must move entire sides of the box along the x, y or z plane by selecting the verts and starting the grab mode and selecting a axis to move on (example: g, y, move mouse)
  7. Press TAB to exit edit mode and with the collision model still selected, press F9 (Editing View) and click the button called "Center New" in the Mesh panel.
  8. Press F4 (Logic View), click "Actor", "Dynamic", "Rigid Body"
  9. Change Mass from 1.00 to 25.00 (or however many pounds you think the object should weight.
    NOTE: In newer versions of Blender NIF Scripts, the export screen overwrites this setting and allows you to change it there.
  10. Change Radius from 1.00 to 0.2 (or whatever the max size of the object radius is)
    NOTE: In newer versions of Blender NIF Scripts, this is no longer necessary and calculated automatically during export.
  11. Click "Bounds" and "Cylinder" should already be selected.
  12. Click "Add Property", change "Float" to "String", change Name from "prop" to "HavokMaterial", add "HAV_MAT_METAL" and press ENTER.

Collision model #2

Add a cylinder collision model for the width of the sword (normally the crossguard)

NOTE: This keeps it from rolling down a hill like a coke can.

  1. Place the 3D cursor at 0,0,0 by pressing Shift + C and press 1 to set your view to the Front.
  2. Press SpaceBar --> Add --> Mesh --> Cube
  3. Press F9 (Editing View), change the Mesh (ME) and Object (OB) name from "Cube" to "Cylinder.001"
  4. Press F7 (Object View), change Drawtype from "Shaded" to "Bounds" and the dropdown under Draw Extra from "Box" to "Cylinder"
  5. Press press R, 90, ENTER which will rotate the cylinder 90 degrees and should match the crossguard fairly close.
  6. Press TAB for edit mode and adjust the edges of the box so they closely cover the crossguard. Be sure not to deform the box such as only moving one vertex...must move entire sides of the box along the x, y or z plane by selecting the verts and starting the grab mode and selecting a axis to move on (example: g, x, move mouse)
  7. Press TAB to exit edit mode and with the collision model still selected, press F9 (Editing View) and click the button called "Center New" in the Mesh panel.
  8. Press F4 (Logic View), click "Actor", "Dynamic", "Rigid Body"
  9. Change Mass from 1.00 to 25.00 (or however many pounds you think the object should weight.
    NOTE: In newer versions of Blender NIF Scripts, the export screen overwrites this setting and allows you to change it there.
  10. Change Radius from 1.00 to 0.2 (or whatever the max size of the object radius is)
    NOTE: In newer versions of Blender NIF Scripts, this is no longer necessary and calculated automatically during export.
  11. Click "Bounds" and "Cylinder" should already be selected.
  12. Click "Add Property", change "Float" to "String", change Name from "prop" to "HavokMaterial", add "HAV_MAT_METAL" and press ENTER.

Export to NIF

  1. Press A to deselect all objects.
  2. Press Ctrl + W to save your model.
  3. Press A to select all objects.
  4. Click File, Export, NetImmerse/Gamebro (*.nif,*.kf)
  5. Type an appropriate name such as CustomSword.nif and click "Export NIF/KF"
  6. Set the following options on the NIF Export screen:
    • Click the "Oblivion" button (if not already set)
    • Click the "Weapon" button on the top-right
    • Scale Correction: 10.00
    • Depressed: Export Geometry Only (.nif)
    • Depressed: Force DDS Extension
    • Depressed: Stripify Geometries
    • Depressed: Smoothen Inter-Object Seams
    • Depressed: Metal
    • Mass: 25.00 (or however many pounds it should be)
    • Depressed: Solid
    • Depressed: Use bhkListShape (this is important if you have more than one collision object)
  7. Exit Blender
  8. Open your exported NIF with NifSkope
  9. Click the Render menu and make sure "Draw Havok" is enabled.
  10. Click the View menu and make sure the following are enabled: Block List, Block Details, Show Blocks in Tree
  11. Expand NiNode --> bhkCollisionObject --> bhkRigidBody --> bhkShapeList
  12. Select each bhkCapsuleShape and adjust the Radius value as necessary to size the object correctly
  13. Save the model and close NifSkope

Havok materials

When adding a HavokMaterial, you can use various settings depending on your situation but here are the most common options (type of material and sound it will give off when dropped)

  • HAV_MAT_STONE
  • HAV_MAT_GLASS
  • HAV_MAT_METAL
  • HAV_MAT_ORGANIC
  • HAV_MAT_WOOD
  • HAV_MAT_HEAVY_STONE
  • HAV_MAT_HEAVY_METAL
  • HAV_MAT_HEAVY_WOOD
  • HAV_MAT_CHAIN

Related pages

References