Difference between revisions of "Finessing Physics"
Jump to navigation
Jump to search
no edit summary
imported>Darknel |
imported>Darknel |
||
Line 3: | Line 3: | ||
Created by [[User:Darknel|Darknel]] | Created by [[User:Darknel|Darknel]] | ||
'''Huge thanks to:''' | |||
m4444x (not only as creator of the almighty Nifskope, but for originally proposing using the bhkTristrips data block in the first place), gundulf (aka fladnug), Brandano and Shon. Thanks also to all the usual suspects over at the CS forums whose indefatigable strivings in various directions of mod making in the face of inumerable setbacks and frustrations is a constant inspiration. | |||
In the absence of an official exporter | '''Now down to business:''' | ||
So you've made a custom mesh, textured it and got it in game. Good for you. Plenty of modders don't get this far. But before you take off your modelling hat there's one more thing you need to think about: Physics. | |||
For weapons misplaced collision boxes will cause clipping through floors, unnatural bounces and other minor annoyances. For architecture not having collision boxes in the right place is outright disastorous. | |||
In the absence of an official exporter creating custom physics for your meshes isn't easy. As with most of the meshing solutions currently available the following is a work around and is consequently imperfect. | |||
== The Main Blocks == | == The Main Blocks == | ||
Before discussing how to add the Havok blocks it's worth saying something about what they are and what they do. Having a look at any nif file you should be able to work this out fairly readily for yourself, but | Before discussing how to add the Havok blocks it's worth saying something about what they are and what they do. Having a look at any nif file you should be able to work this out fairly readily for yourself, but in brief: | ||
'''bhkCollisionObject''' | '''bhkCollisionObject''' | ||
Line 54: | Line 61: | ||
the Shape block itself should be used. | the Shape block itself should be used. | ||
== | ==Simple Collision Modelling== | ||
''Step 1'' | ''Step 1'' | ||
Line 66: | Line 73: | ||
Finally you'll need a bhklistshape. Again you can take one from the axe meshes. | Finally you'll need a bhklistshape. Again you can take one from the axe meshes. | ||
Line 93: | Line 99: | ||
n+3: Then the trishape/strip blocks. | n+3: Then the trishape/strip blocks. | ||
Basically the sequence of block numbers should run inversely to the order in which they appear in the Nifskope block list heirarchy. | |||
Line 111: | Line 119: | ||
== Better Collision Modelling == | |||
3DS Max users now have the benefit of gundulf's plugin which automatically generates collision models on export. You can link to the download of that plugin and read a tutorial on it's use [http://www.silgrad.com/wbb2/thread.php?postid=31448 here.] Users of this plugin may also find it helpful to read through this tutorial though since the technique described here is essentially the long hand version of what the plugin is doing. | |||
But what about those of us not fortunate enough to have the latest version of 3DS? Well, do not despair. Because although the route is a little more arduous the creation of collision meshes directly matching your mesh is still a possibility. The following step by step will show how to produce the same end result as the plugin afore-mentioned via a few simple Nifskope hacks. But first a warning: | |||
'''WARNING''' | |||
The following technique generates collision objects in a more processor intensive | |||
manner than the Simple Collision Modelling technique discussed above. Because | |||
we will be dealing with TRIstrips the quads of your mesh will be subdivided into | |||
triangles. That means for instance even a basic shape like a box will have 12 | |||
faces rather than 6. In detecting collisions the engine calculates against all | |||
faces in the mesh thus it is strongly urged that you make every effort to minimise | |||
the number of faces. | |||
Wherever possible then the technique below should be combined with the technique | |||
above so that the bhkNiTristrip block is used only for sections of detailing where | |||
using the primitive shapes would be impractical or impossible. | |||
''Step 1'' | |||
The first phase of this process is to export your mesh from the modelling application (whether as .nif or .obj is really immaterial). If you're unsure of how to do this see [[Custom Weapons with Nifskope]] for further details. | |||
The additional element in doing this though is to also create and export a less detailed version of your mesh which will be used as the collision model. In fact you may need to export more than one additional mesh if you're new model is going to be built from different materials. For instance the stone sections will need to be exported as one part, the wood sections as another and so forth. | |||
From a workflow point of view I tend to find it helpful to duplicate the original mesh, move it to a different layer and then start to savage it. | |||
Your objective in this phase is to reduce the face count as far as possible. This can be done by hand or your application may have some tools to ease the process. | |||
Blender users may find the decimate modifier helpful. Details [http://mediawiki.blender.org/index.php/Manual/PartII/Modelling/Modifier/Mesh_Decimator here] | |||
Remember also so that anything you could just use a bhkprimitive for (standard boxes, capsules, etc) can also be omitted and built up using the Simple Collision Modelling techniques above. | |||
''Step 2'' | |||
By the end of step 1 you should now have two (or more) nif files. One which is the mesh as it will be seen in game (hereinafter the primary nif) and another (or others) which is the mesh as it will be collided with in game (hereinafter the secondary nif). | |||
If your collision mesh has omitted any areas because you're going to create them using the Simple Collision Modelling techniques, you should do that now. Build those structures up within the primary nif, following the guide above. | |||
So now on to converting those additional nifs into collision meshes. The first thing you're going to need is a bhkNitristrip block. You can find one of those in the following nif: | |||
'''BSA\meshes\dungeons\ayleidruins\exterior\arstatue01.nif''' | |||
Highlight that block in the block list and in the block details you should see Num Strips Data, followed by an array drop down showing which block the strips data is being taken from. For now, set the strips data to -1, copy the block and paste it into your primary nif. Don't save the change of setting the strips data to -1 on the statue nif, that's just a temporary measure to limit confusion on pasting it. | |||
''Step 3'' | |||
Now in a new Nifskope window open your secondary nif. Go to it's NiTristrips block and within that to the NiTristripsData block. Copy the NiTristripsDatablock and paste it into your primary nif. Close the secondary nif window. | |||
In the primary nif window, go to the bhkTristrips block you pasted in Step 2 and in the block list details change the strips data (which you set to -1 in Step 2) to point to the tristrips data block you just pasted across. | |||
''Step 4'' | |||
From here on in, the process is essentially the same as if you were following the Simple Collision Modelling guide above (the bhkNiTristrips block can be treted essentially like any other bhk shape block). Set it's material to whatever you want, link it in to the bhkrigidbody block. Set the heirarchy up so that it runs the same way as discussed in the earlier part of this guide. | |||
And you're done. | |||
== Additional Assistance == | |||
If you have any questions or ideas pertaining to the above please discuss them on this [http://www.elderscrolls.com/forums/index.php?showtopic=448144&hl=havok+hacking thread.] |