3ds Max/Guides/Collision Example 1

From NifTools
Jump to: navigation, search

Contents


This guide is describes one procedure used to convert add collision to a static object and export from Max to Oblivion. This particular guide is going to use the Havok MOPP implementation. MOPP (Memory Optimized Partial Polytope) is a way of compressing bounding volume data for arbitrary polygon meshes. MOPP is very effective at speeding up collision detection in complex shapes.

This procedure is not the optimal strategy but is about the quickest method to get MOPPs into Oblivion using Max.

Software

Software used during this procedure was 3ds Max, and NifSkope.

Download

The NifTools Max Plug-in can be downloaded from http://www.niftools.org. Click on the Downloads link in the navigation pane to download the latest release from the sourceforge website.

Basics

Getting Started

Ensure that you have the NifTools plugin properly loaded for your version of Max. You should have the **Niftools Max Plugin** listed in the Plugin Manager which is located under the Customize menu by the name Plug-in Manager....

niftools_plugin_loaded.png

Next I'm going to start with an existing mesh with collision but import without collision. This will represent an existing model that needs collision.

For those following along at home, this is meshes\architecture\tents\tent03.nif in the base Oblivion meshes.

tent.png

The scene contains a cloth tent with wooden support beams and a metal cap. We want to export this information from 3ds Max into objects that Havok can use when in Oblivion.

Setting Up Rigid Bodies

One of the first things we need to do is make the tent a Rigid Body. This will represent the Tent properties in Havok and is represented in max as helper object named bhkRigidBody.

bhkRigidBody is a helper object available under the Create panel. Select the Helper system. Select Niftools filter. Finally select the bhkRigidBody button. This is a simple point dummy object so you can place it anywhere on the scene though close to the object it represents is convenient. I will usually link the object to a parent bone if there is one so that its a child of that node. In this case the tent is the scene so there is no need.

example1_tent_rigidbody.png

Now that we have a rigid body we can set some of its properties. The tent is going to be an immovable object so we assign it a mass of 0.0 kg. Which Havok uses internally to represent an immovable object. Next we uncheck Allow Transforms to further confirm that this is not a movable object. I leave the Material as stone since we will override the individual collision properties later in the process.

example1_tent_rigidbody_props.png

Setting Up Collision Proxies

Havok does not use the original objects directly but rather would use simplified forms. This is primary because collision is very expensive to implement and typically does not require a lot of detail. Usually a box, sphere, or capsule will do just fine and the player would never be the wiser.

For the tent we are going to do some quick collision for the 3 major pieces of the tent. Its wooden support beams, metal cap, and cloth exterior.

The bhkCollProxy is an object which uses another mesh to represent the collision. Usually this a direct one-to-one mapping with the scene objects but still allows the mesh to be exported in the scene. This is different from using the bhkRigidBody Modifier which converts a mesh into a collision object and effectively removes that object from the scene for normal export.

bhkCollProxy is a helper object available under the Create panel. Select the Helper system. Select Niftools filter. Finally select the bhkCollProxy button.

I've hidden everything but the support beams then created the bhkCollProxy object. Initially there is no meshes in the proxy so select the Add button and then select the meshes to proxy with the mouse. Hint: You don't have to pick the mesh but can use the Select by Name button to find meshes by name to add instead.

example1_tent_supportbeams_proxy.png

Because the beams are wooden, I change the material to wood. Select the Bounding Volume to be **Packed Strip Shapes** so that it can be used with MOPP. The other options are for simpler collision types. Note that Convex and Strips Shape are actually slower in many cases than the MOPP shape so use those only if you really intend to.

Optionally you can do a minor optimization on the mesh to try and remove unnecessary vertices now since the collision doesn't really care about detailed meshes.

Repeat for the next to objects.

example1_tent_exterior_proxy.png

The exterior is several objects and is made of Cloth.

example1_tent_cap_proxy.png

The cap is metal so it stands by itself.

Add Proxies to Rigid Body

With the Collision representation mostly ready now we need to add them to the bhkRigidBody created earlier so that that the Havok tent actually has some objects to work with.

example1_add_collision_to_body.png

With that we are done with configuring the mesh for now. Lets export it...

Export

Exporting the scene is fairly straight forward now.

Select File | Export... | Netimmerse/Gamebryo (*.NIF, *.KF) and enter the file name to export to.

example1_tent_export_settings.png

Ensure that Oblivion is the game type and Collision is selected. The Hidden Nodes setting can be used to filter out unwanted nodes.


Analyze in Nifskope

Its always a good idea to load the export in Nifskope before using it anywhere.

example1_tent_nifskope_settings.png

We can see the metal, cloth and wood settings in the rigid body area. We can also see the bhkMoppBvTreeShape which is the holding object of the MOPP tree.

Personal tools