Freedom Force/Bouningboxes

From NifTools
Jump to: navigation, search

Adding bounding boxes to FF objects


Most FF objects don't have a bounding box whilst most FF3R objects do. As anyone who has tried to use FF objects in FF3R knows, this presents huge problems. The FF3R engine requires an object to have a bounding box for a character to interact with it. Even FFEdit2 can't select an object with the cursor if it doesn't have a bounding box. Renegade took up the task of re-creating FF objects some time ago and has made great progress. But it's a long, tedious and boring task. With NifSkope people can convert FF objects to give them boundingboxes.

There are three ways to add a bounding box: 1. Create an appropriate bounding box in a 3D modeller and import it. 2. Take a suitable bounding box from an FF object that does have one and import that. 3. Convert the object to FF3R and then import a suitable FF3R bounding box.

We will only cover the last two methods in this tutorial. Besides, there are some interesting tricks you can perform with methods 2 and 3. For this example we'll convert the street object crate01.nif.

Bounding box basics.

Character bounding boxes are usually rectangular and approximate the volume of the character mesh. Object bounding boxes conform more closely to the shape of an object (presumably to prevent false collision detection); usually having a shape like a vastly simplified version of the object. For example med_cot.nif is asymmetrically T-shaped. Selecting a bounding box to import is a judgement call and it can take some trial and error to select the best donor. Finding FF objects with bounding boxes

The best way to do this is to use 'windows find' on the ~\data\art\library\area_specific directory and its children. Leave the 'name' field blank but enter boundingbox in the 'containing text' field. Despite the fact that NIFs are binary files they contain the actual text names of nodes. This will give you a modest list of FF objects that have bounding boxes. (It will include a few terrain NIFs). There should be about 150 of them. You can then inspect this list of objects to determine if the bounding box is appropriate to use.

FF3R Objects

Most FF3R objects have bounding boxes, so it is usually a matter of selecting on objects of similar size and shape to locate a donor. The smae search meathod as detailed above will give a full list.

Converting FF objects to FF3R

This is fairly straightforward. Merely use the converter of your choice, as if the object were a character NIF without keyframes. Remember to work on a copy of the FF object. It won't seem to be any different but examination in a hex editor will reveal it to be a NIF so NifSkope will not complain when importing from an FF3R object.

The Tutorial

We'll assume you have selected an appropriate bounding box from a suitable object and converted your FF objects to format if you are going to use an FF3R bounding box. For this tutorial we will use postbox.nif to provide the bounding box (there are better choices).

Open two instances of NifSkope. Ensure you have render, show hidden, enabled in them both. Open your copy of crate01.nif, in the other postbox.nif. In the postbox window, open the scene root and left click on the boundingbox node. Then right click and block,copy branch. Then in the crate01 window, left click on the scene root, then right click and block,paste branch. You should see the bounding box projecting above the crate. It's too narrow and too high, but would actually function in game as it is.

Let's improve it. We have several choices here. We could scale the boundingbox up, then break out a hex editor (or a mesh editor if we haven't converted it to and rescale the boundingbox into a cube the same size as the crate. But instead, we'll use a simple but effective cheat. Open the crate01 node and then the NiTrishape. See the NiTriShapeData node? If we used that on the boundingbox, we will make it the same size as the crate. Left click on the crate NiTriShapeData. Then right click and block,copy. Then click on the scene root and right click, block,paste. We now have an orphan NiTriShapeData. We want the boundingbox to use it. Click on the boundingbox node. In the block details notice that Data refers to the imported NiTriShapeData node. Left click on this and change the number to the node we have just pasted. You will see the two nodes swap places. You will also note that our now cube-shaped boundingbox is offset. Change the co-ordinates on the boundingbox node to be the same as the co-ordinates on the crate_01 node. (everything 0 in this example) You'll see the bounding box position itself perfectly. The final step is to make the settings for the new NiTriShapeData the same as the old. You may need to change unknownshort2, NumUVsets2, hasUV and Num UV Sets depending on the version of the NiF. Finally, right click on UV sets and select array,update to remove the UV mapping. The last step is to delete the orphan NiTriShapeData node and you are done. Save the crate and get someone to smash it in FFedit2.

Personal tools