Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial - How to get multiple MOPP shapes
03-27-2009, 02:12 AM,
#1
Tutorial - How to get multiple MOPP shapes
[big]How to get multiple MOPP shapes under the same bhkRigidBody block.[/big]

This tutorial assumes you have the latest 3D Studio Max exporter, currently 3.4.

Download the tutorial files.

[title]Creating the collision meshes[/title]
Open the scene "Tutorial Scene 01.max" from the tutorial files archive. You'll get an error about missing textures, but just ignore that as the textures aren't important. You'll see four collision meshes which I created for one of my windows. I've named them "Collision [Material]" because it helps me separate them from the visible models and is also a good reminder which material they should have.
[Image: th_01.jpg]

[title]Creating the helpers[/title]
Create four bhkRigidBody helper objects. If you haven't used them before then you can find them on the Create panel, under the Helpers tab. Choose Niftools in the drop-down list, depress the bhkRigidBody button and click in your viewport to add one.

Set the Material of the first bhkRigidBody helper to Heavy Stone. Set the secnd to Heavy Metal, the third to Metal, and the fourth to Glass. Then add each collision mesh to its respective helper. Tutorial Scene 02.max has these changes.
[Image: th_02.jpg]

[title]Grouping the helper/collision pairs[/title]
Move all the bhkRigidBody helpers to origin (X0 Y0 Z0).
Now we're going to group all except one helper/mesh pair. We want to group the other pairs so they'll export separately, and leave one pair in the scene root so that it gets inserted into the main NiNode and gives us a headstart on adding the others in later on.

So, choose three pairs of collision mesh and helper and group them. If you haven't grouped objects before, it's done by selecting them and then choosing Group > Group in the main menu. Name them the same as the collision mesh so you can tell them apart in NifSkope. Tutorial Scene 03.max has this done.
[Image: th_03.jpg]

[title]Exporting it[/title]
Export it with the settings shown in the left screenshot. Run amorilia's nif optimizer script on it to remove any bogus nodes. It'll look like the right screenshot in NifSkope.
[Image: th_04a.jpg] [Image: th_04b.jpg]

[title]NifSkope tweaking[/title]
Right-click in an empty area of the Block List window and choose "Block > Insert" and then on the popup menu choose "Havok > bhkListShape". It'll look like in screenshot #5a.

Unroll the bhkCollisionObject block of the main NiNode. Select the bhkRigidBodyT block. At the top of its Block Details is a line named Shape. Doubleclick on the value and change this to the number of the bhkListShape you created. It'll look like in screenshot #5b.

Select the bhkListShape. In its Block Details is a line named Num Sub Shapes. Change this to the number of collision meshes you have, which in the tutorial nif is 4. See the line just below it that is named Sub Shapes? Right-click on that line and choose Array > Update. A plus sign will appear just left of it. Click the plus sign to unroll the list. Set the value of the first Sub Shapes to the disembodied bhkMoppBvTreeShape at the bottom of the Block List, which in the tutorial nif has the number 5. It'll look like in screenshot #5c.

Now unroll the three NiNodes at the bottom of the Block List and note the number of each bhkMoppBvTreeShape. Enter these numbers in the slots of the Sub Shapes list. It'll look like in screenshot #5d.

Now you don't need those three NiNodes any longer, so go ahead and delete them by selecting them one after the other and pressing CTRL+D.

There you have it, a clean nif with multiple MOPP materials Smile

[Image: th_05a.jpg] [Image: th_05b.jpg] [Image: th_05c.jpg] [Image: th_05d.jpg] [Image: th_05e.jpg]

[title]Sundry notes[/title]
You can mix and match different collision types in a bhkListShape. I've successfully mixed MOPP and box shapes and it works perfectly.

Obviously you can't mix different layers since that's controlled in the bhkRigidBody block. To do that you need to retain the NiNodes with collision - the same as the ones deleted in the tutorial - as children of the main NiNode.

If you look at the Block Details of the bhkListShape you'll notice it has a line with the name Material. This Material is of no consequence since the materials of the Sub Shapes always take precedence.

Sometimes modellers go to lengths to prep collision meshes, like stripping the mesh of uvw mapping. The exporter totally ignores uvw mapping and material settings for collision meshes. It's just not part of the data that's exported. It's always good to reset the XForm of collision meshes before using them though. Reset XForm is a procedure found on the Utilities panel of 3D Studio Max. By resetting the XForm of a model you fix it in its current position and clear any position-, rotation- and scale changes it might have.
¤ How to add images or files to your post ¤ Silgrad's UBBCode
My pet peeve: huge images in img code. I reserve the right to make any such image into a clickeable thumbnail whenever I see it.
Angel mired in filth
[Image: SignatureBannerRazorwing.jpg]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)