Creating Physics Shapes with Multiple States
by Joe Espinoza · in Torque 3D Professional · 08/10/2010 (11:07 pm) · 4 replies
Creating Physics shapes with multiple states.
In this explanation on creating physics shapes, I'll be going through the steps on how to set up multiple states. Utilizing this technique gives you the option of having multiple states of destruction for a single object. There will be similarities to the information on creating regular physics shapes, but the biggest difference is that you'll basically be creating two physics shapes and setting up the datablocks to recognize both states. Like before, I'll be using 3ds Max to create the art asset and setting up the nodes in a hierarchy. This time, I have provided screenshots of a fence object that I worked on to give you a more visual example of these steps. As always, I like to keep my max file as organized as I can so I utilize the Layer Manager to help minimize any confusion. Again, keeping your max file organized is very important to the whole process so that you won't have to waste time deciphering what you did later on down the road.
In the image below, you can see how I set up my layers in two states. These states are represented in the layer names, 1A and 1B.

1. After you create the mesh in 3d and set it's pivot to '0.0' in world space, you will need to clone the object using the 'copy' method as oppose to the 'instance'. Now that you have two of the same exact meshes, make sure you name them correctly. For the prefix of the name, I use a name that describes the object and I usually prefer to use a suffix of 'unbk' for the unbroken mesh and 'bk' for the broken mesh (This can be whatever you like, but make sure it's something that isn't too complicated because once we start setting up the hierarchy, you'll want to minimize any confusion of which mesh is which). So, for example, my unbroken mesh will be named "fence_1_unbk100." As for the broken mesh, just give it a temp name since you will be breaking it up into debris pieces. I will explain more about the naming convention throughout this tutorial. You should also go ahead and create the collision for the unbroken mesh. Don't worry about creating collision for the broken version yet. Make sure that your collision's pivot is also set to '0.0' in world space.
The suffix "100" will depend on the detail nodes explained later in this tutorial.
*Create a layer in the layer manager for your unbroken mesh, and another layer for your broken mesh. In my case, I named the layers "Fence 1 Unbroken" and "Fence 1A Broken State"

2. Next, you will need to break apart your 'broken' version of the mesh any way you prefer. There's not a quick process for doing this, but I have found some plugins that allow you to break up a mesh. These plugins are decent, but depending on what the mesh is (ie. wood, rock, metal, etc) these plugins might not give you the results that you are looking for and you will most likely have to clean up any unnecessary edges on your mesh. Also, try not to go overboard with the amount of debris pieces so that it doesn't slow down game performance (The most debris pieces I've created for a mesh has been around the mid twenties). You will also need to make sure that each debris piece's pivot is set to '0.0' in world space. While creating these debris pieces, you should keep in mind that there is going to be a "second state" part of the mesh which will also be a physics shape that you can destroy again. For the fence object, I broke off most of the top boards of the mesh for the top debris pieces and left about half of the fence for the next state. The image below shows the four different states of debris and base meshes.

The top left shows the 1st state of broken debris. The top right shows the base mesh of the 1st state that will be left after the first state of destruction happens. This mesh will also need to be cloned using the 'copy' method. Now that you have two 'state 1' base meshes, give one a unique name. In my case, I named this one fence_1A_base100. The cloned one can have a temp name for now. This cloned version will be the 2nd state of broken debris. You will need to break this cloned version up like you did on the 1st state of broken debris. Be sure to save out a final base mesh as shown in the bottom right part of the image above. This final base mesh will be what's left after all the states of the physics shape have been destroyed.
This final base piece should be set apart from the debris pieces and named something like, fence_1B_base100. If you have multiple base parts, then name them, fence_1B_base_one100, fence_1B_base_two100, fence_1B_base_three100, etc. Make sure that there is not a numerical digit right before the suffix, 100.
*Create a few layers in the layer manager for the base mesh and 2nd state meshes. In my case, I named the layers "Fence 1A Base," "Fence 1B Base," and "Fence 1B Broken State." Put all the 1st state of broken debris into the layer for the 1st state of broken debris and put all the 2nd state of broken debris into the layer for the 2nd state of broken debris. Next put the state 1 base mesh into the layer for the 1st state base mesh and put the final state base mesh into the layer for the 2nd state base mesh.
The naming convention for the debris pieces are similar to the unbroken mesh name. I use the same prefix name as the unbroken mesh, but within the naming convention, I use 'bk' for broken. For example, my broken mesh, which are all the debris pieces, will be named "fence_bk_A_one100, fence_bk_A_two100, fence_bk_A_three100, and so on." Do the same for the second state of debris pieces, but substitute the "A" in the name with a "B".
3. Now that your mesh is broken up, make sure that you adjust the UV's correctly on the inner/hidden broken areas of the debris pieces. I usually retain a space in my textures for the broken faces of the debris.

4. Next step is to setup the torque nodes and collision volumes for the debris. Since we are creating two separate physics shapes, you will need to set up two sets of torque nodes. It's easier to set them up one at a time. The torque nodes consist of four main dummy objects (plus dummy objects for collision markers) and one mesh box object. The names for the dummy objects will be "base", "start", "detail100", and "detail10." The collision markers, which are also dummy objects, depends on how many collision volumes you have for each of your debris pieces and their naming convention are, "collision-01, collision-02, collision-03, and so on." As for the mesh box object, it's name should be "bounds." The dummy objects can be any size you'd like and placed at '0.0' in world space, but the bounds box object needs to fit tightly around the mesh object, which in my case is the fence. Make sure that no part of the mesh extrudes through the bounds box object. Also place the pivot point of the bounds box object to '0.0' in world space. The bounds has to be a six sided box object, but can be scaled non-uniformely and can even be converted to an edit poly or edit mesh.
Now to set them up you will need to open the schematic view. From here you will link the start, detail100, detail10, and collision markers to the base node. Leave the bounds unlinked. The detail nodes are used to determine the level of detail (LOD) in game, so the suffix numbers could vary depending on the distance you feel comfortable with in game. This suffix number will determine what number you use at the end of your mesh names.
*Create two layers in your layer manager for your torque nodes. Since we are setting up two separate physics shapes, then you will want to have two layers for each state. In my case, I have a layer called "Fence 1A Torque Nodes" and "Fence 1B Torque Nodes."
Below is an image to the method of my schematic madness. This image shows how I organize my nodes so that it helps to minimize any confusion.
Click here for full size

5. Setting up the collision for the debris pieces is a little time consuming but necessary. Basically create a collision volume for each individual debris piece. There are four different types of collision volumes that Torque recognizes (colbox, col, colsphere, colcapsule). Their naming convention should be set up like, colbox-1, colbox-2, colbox-3, or col-1, col-2, col-3, etc. For each collision volume, there will need to be a collision marker as well. These collision markers will also need to be linked to the base node, as shown in the image under step three.
colbox is used for box object collision
col is used for irregular shaped collision (Make sure that non of your collision volumes are concave)
colsphere is used for spherical shaped collision
colcapsule is used for cylindrical shaped collision
Each of these types of collision can also be used together. Like if you had a debris piece that uses a box collision, a piece that uses an irregular shaped collision, and a piece that uses a spherical collision, the naming convention would be something like, colbox-1, col-2, colsphere-3, etc.
*Also, for the collision volume names, you must use a dash (-) instead of an underscore (_) between the collision name and numerical value. For example, colbox-1 will work, but colbox_1 will not work.
*Create two layers in your layer manager for both states of your broken mesh collision volumes and collision markers. The amount of broken mesh collision volumes and markers are high in number so it's better to save all of them into their own layer. I usually save the base collision volumes and markers within the base layer and I do the same for the unbroken mesh, collision volumes, and collision markers.

6. Next we need to create the LOD helpers for the debris pieces. Create as many dummy helpers as you have debris pieces and link all the new dummy objects to the start node in the schematic view. These LOD helpers can be any size and placed at '0.0' in world space. The naming convention for the LOD helpers can be whatever you like as long as the final letter in the name is not numerical. For example, I usually name my LOD helpers as, lod-helper01A, lod-helper02A, lod-helper03A, etc.
7. To set up the LOD for the debris pieces, you will need to clone all of your debris meshes using the 'copy' method instead of the 'instance' method. The naming of these cloned debris pieces should coincide with the same pieces they were cloned from. For example, the clone of fence_bk_A_one100, should be named, fence_bk_A_one10. Again, the suffix number will be determined on the detail node's LOD distance that you are comfortable with. Now you will link both versions of the debris pieces and the collision to the LOD helpers as shown below. You can use the same collision for both of the debris meshes. Also if you look at the image below, I kept the nodes and mesh names organized by using either 01, 1, one, and 02, 2, two, and so on.
*Both steps, 5 and 6, will need to be repeated for the second state as well.
*In your layer manager, make sure that your cloned debris pieces are saved into the same layer that your broken debris are in. Also, I usually put the LOD helpers within the same layer that the broken collision is in.

8. Now we can setup the rest of the hierarchy for both states (Refer to the image under step 3 to see how I layout both states with their own torque nodes). For the unbroken version of the mesh, link all of the collision pieces to the unbroken mesh and then link the unbroken mesh to the start node. Notice in the image below that the collision markers for this branch of the hierarchy are the same amount as the collision volumes for the unbroken mesh. Next step is to do the same for the base mesh and it's collision volumes. Link all the base collision volumes to the base mesh then link the base mesh to the start node.

9. Now that everything is linked correctly and named correctly, then it is time to export the meshes. This is where the layer manager comes in handy. If you set up everything into separate layers, then exporting shouldn't be a painful process. First unhide only the layers that you want to have exported. For example, if you are exporting the broken meshes, then you will unhide only the broken mesh, broken collision, and torque nodes layers. Select everything in the viewport and confirm that you have all the correct meshes and nodes selected in your schematic view. Once these are selected, then choose 'Export Selected' and specify the directory you would like to save into and at the bottom of the export window, expand "Save as type" and choose "OpenCOLLADA (*DAE), then give it a filename.
*For the LOD parts of the broken mesh, you will need to determine which parts of the debris pieces are small enough to LOD sooner than the larger pieces. Once you know which ones you would like to LOD out first, select all of the broken debris pieces along with the collision volumes, collision markers, and the LOD helpers along with the torque nodes. Then unselect the small debris pieces that you decided to have LOD first and export your selection.

My exported filenames for this example are:
fence_1_bkbase_a.DAE is the 1st state base mesh.
fence_1_bkbase_b.DAE is the 2nd state base mesh.
fence_1_bkstate_a.DAE is the 1st state of debris.
fence_1_bkstate_b.DAE is the 2nd state of debris.
fence_1_unbk.DAE is the unbroken mesh.
10. Now that you've saved the collada files, the next step is to set up the datablocks within the physicsShape.cs file. You can edit this with notepad. Below is the setup for the pier pieces. Just scroll to the bottom and enter the information using your filenames. Also, the areas for the "PhysicsDebrisData" and "PhysicsShapeData" will need a unique name that you will use in the Datablock Editor in the Torque Engine.
_______________________________________________
// fence 1 broken state A
datablock PhysicsDebrisData( PSfence1Adebris )
{
lifetime = 60.0;
lifetimeVariance = 0.0;
velocity = 0.1;
velocityVariance = 0;
shapeFile = "art/shapes/physicsShapes/fence_1_bkstate_a.DAE";
mass = 1.5;
dynamicFriction = 0;
staticFriction = 0.3;
restitution = 0.0;
linearDamping = 0.1;
angularDamping = 0.1;
linearSleepThreshold = 1.0;
angularSleepThreshold = 1.0;
waterDampingScale = 10;
buoyancyDensity = 0.8;
friction = "0.2";
};
datablock PhysicsShapeData( PSfence1A )
{
category = "PhysicsShape";
shapeName = "art/shapes/physicsShapes/fence_1_unbk.DAE";
mass = 0;
debris =PSfence1Adebris;
explosion = "SplinterExplosion";
friction = "0.1";
linearDamping = "0.1";
angularDamping = "0.1";
buoyancyDensity = "0.2";
staticFriction = "0.1";
restitution = "0.3";
invulnerable = "0";
minDamageAmount = "0.5";
destroyedShape = "PSfence1B";
};
// fence 1 broken state B
datablock PhysicsDebrisData( PSfence1Bdebris )
{
lifetime = 60.0;
lifetimeVariance = 0.0;
velocity = 0.1;
velocityVariance = 0;
shapeFile = "art/shapes/physicsShapes/fence_1_bkstate_b.DAE";
mass = 1.5;
dynamicFriction = 0;
staticFriction = 0.3;
restitution = 0.0;
linearDamping = 0.1;
angularDamping = 0.1;
linearSleepThreshold = 1.0;
angularSleepThreshold = 1.0;
waterDampingScale = 10;
buoyancyDensity = 0.8;
friction = "0.2";
};
datablock PhysicsShapeData( PSfence1baseB )
{
category = "PhysicsShape";
shapeName = "art/shapes/physicsShapes/fence_1_bkbase_b.DAE";
mass = 0;
invulnerable = "1";
};
datablock PhysicsShapeData( PSfence1B )
{
category = "PhysicsShape";
shapeName = "art/shapes/physicsShapes/fence_1_bkbase_a.DAE";
mass = 0;
debris =PSfence1Bdebris;
explosion = "SplinterExplosion";
friction = "0.1";
linearDamping = "0.1";
angularDamping = "0.1";
buoyancyDensity = "0.2";
staticFriction = "0.1";
restitution = "0.3";
invulnerable = "0";
minDamageAmount = "1.25";
destroyedShape = "PSfence1baseB";
};
_______________________________________________
11. In the Torque engine's datablock editor, you will need to specify the "destroyedShape" for each state. For the 1st state, my PhysicsShapeData name is "PSfence1A", and for the 2nd state, my PhysicsShapeData name is "PSfence1B". Also, for the final base PhysicsShapeData name, I used "PSfence1baseB". So in your Datablock LIbrary, choose your first state physics shape and scroll down to the Media area and under "destroyedShape" choose your 2nd physics shape from the drop down. Next, back at the top, choose the 2nd physics shape and scroll down to the Media area and under "destroyedShape" choose your final base mesh.

12. Now that the datablocks are set up for multiple states of destruction, go into the Object Editor and navigate to the physicsShapes directory and double click on the 1st state physics shape to place it in the level. Next throw a grenade at it, then once the debris settles, throw another grenade at it for the final destruction.
I was told that you can have as many multiple states of physics shapes as you want, but I haven't set one up past 2 states. If you do set up more than two states, then the additional states would basically be created the same way as the previous two states.
Also, you can specify the type of damage to each state by tweaking the "minDamageAmount" under the "Dynamic Fields" category in the Datablock Editor. For example, I set the "minDamageAmount" for the 1st state to low number so that gunfire destroys it and I set the "minDamageAmount" for the 2nd state to a higher number so that only grenades destroy it.


In this explanation on creating physics shapes, I'll be going through the steps on how to set up multiple states. Utilizing this technique gives you the option of having multiple states of destruction for a single object. There will be similarities to the information on creating regular physics shapes, but the biggest difference is that you'll basically be creating two physics shapes and setting up the datablocks to recognize both states. Like before, I'll be using 3ds Max to create the art asset and setting up the nodes in a hierarchy. This time, I have provided screenshots of a fence object that I worked on to give you a more visual example of these steps. As always, I like to keep my max file as organized as I can so I utilize the Layer Manager to help minimize any confusion. Again, keeping your max file organized is very important to the whole process so that you won't have to waste time deciphering what you did later on down the road.
In the image below, you can see how I set up my layers in two states. These states are represented in the layer names, 1A and 1B.

1. After you create the mesh in 3d and set it's pivot to '0.0' in world space, you will need to clone the object using the 'copy' method as oppose to the 'instance'. Now that you have two of the same exact meshes, make sure you name them correctly. For the prefix of the name, I use a name that describes the object and I usually prefer to use a suffix of 'unbk' for the unbroken mesh and 'bk' for the broken mesh (This can be whatever you like, but make sure it's something that isn't too complicated because once we start setting up the hierarchy, you'll want to minimize any confusion of which mesh is which). So, for example, my unbroken mesh will be named "fence_1_unbk100." As for the broken mesh, just give it a temp name since you will be breaking it up into debris pieces. I will explain more about the naming convention throughout this tutorial. You should also go ahead and create the collision for the unbroken mesh. Don't worry about creating collision for the broken version yet. Make sure that your collision's pivot is also set to '0.0' in world space.
The suffix "100" will depend on the detail nodes explained later in this tutorial.
*Create a layer in the layer manager for your unbroken mesh, and another layer for your broken mesh. In my case, I named the layers "Fence 1 Unbroken" and "Fence 1A Broken State"

2. Next, you will need to break apart your 'broken' version of the mesh any way you prefer. There's not a quick process for doing this, but I have found some plugins that allow you to break up a mesh. These plugins are decent, but depending on what the mesh is (ie. wood, rock, metal, etc) these plugins might not give you the results that you are looking for and you will most likely have to clean up any unnecessary edges on your mesh. Also, try not to go overboard with the amount of debris pieces so that it doesn't slow down game performance (The most debris pieces I've created for a mesh has been around the mid twenties). You will also need to make sure that each debris piece's pivot is set to '0.0' in world space. While creating these debris pieces, you should keep in mind that there is going to be a "second state" part of the mesh which will also be a physics shape that you can destroy again. For the fence object, I broke off most of the top boards of the mesh for the top debris pieces and left about half of the fence for the next state. The image below shows the four different states of debris and base meshes.

The top left shows the 1st state of broken debris. The top right shows the base mesh of the 1st state that will be left after the first state of destruction happens. This mesh will also need to be cloned using the 'copy' method. Now that you have two 'state 1' base meshes, give one a unique name. In my case, I named this one fence_1A_base100. The cloned one can have a temp name for now. This cloned version will be the 2nd state of broken debris. You will need to break this cloned version up like you did on the 1st state of broken debris. Be sure to save out a final base mesh as shown in the bottom right part of the image above. This final base mesh will be what's left after all the states of the physics shape have been destroyed.
This final base piece should be set apart from the debris pieces and named something like, fence_1B_base100. If you have multiple base parts, then name them, fence_1B_base_one100, fence_1B_base_two100, fence_1B_base_three100, etc. Make sure that there is not a numerical digit right before the suffix, 100.
*Create a few layers in the layer manager for the base mesh and 2nd state meshes. In my case, I named the layers "Fence 1A Base," "Fence 1B Base," and "Fence 1B Broken State." Put all the 1st state of broken debris into the layer for the 1st state of broken debris and put all the 2nd state of broken debris into the layer for the 2nd state of broken debris. Next put the state 1 base mesh into the layer for the 1st state base mesh and put the final state base mesh into the layer for the 2nd state base mesh.
The naming convention for the debris pieces are similar to the unbroken mesh name. I use the same prefix name as the unbroken mesh, but within the naming convention, I use 'bk' for broken. For example, my broken mesh, which are all the debris pieces, will be named "fence_bk_A_one100, fence_bk_A_two100, fence_bk_A_three100, and so on." Do the same for the second state of debris pieces, but substitute the "A" in the name with a "B".
3. Now that your mesh is broken up, make sure that you adjust the UV's correctly on the inner/hidden broken areas of the debris pieces. I usually retain a space in my textures for the broken faces of the debris.

4. Next step is to setup the torque nodes and collision volumes for the debris. Since we are creating two separate physics shapes, you will need to set up two sets of torque nodes. It's easier to set them up one at a time. The torque nodes consist of four main dummy objects (plus dummy objects for collision markers) and one mesh box object. The names for the dummy objects will be "base", "start", "detail100", and "detail10." The collision markers, which are also dummy objects, depends on how many collision volumes you have for each of your debris pieces and their naming convention are, "collision-01, collision-02, collision-03, and so on." As for the mesh box object, it's name should be "bounds." The dummy objects can be any size you'd like and placed at '0.0' in world space, but the bounds box object needs to fit tightly around the mesh object, which in my case is the fence. Make sure that no part of the mesh extrudes through the bounds box object. Also place the pivot point of the bounds box object to '0.0' in world space. The bounds has to be a six sided box object, but can be scaled non-uniformely and can even be converted to an edit poly or edit mesh.
Now to set them up you will need to open the schematic view. From here you will link the start, detail100, detail10, and collision markers to the base node. Leave the bounds unlinked. The detail nodes are used to determine the level of detail (LOD) in game, so the suffix numbers could vary depending on the distance you feel comfortable with in game. This suffix number will determine what number you use at the end of your mesh names.
*Create two layers in your layer manager for your torque nodes. Since we are setting up two separate physics shapes, then you will want to have two layers for each state. In my case, I have a layer called "Fence 1A Torque Nodes" and "Fence 1B Torque Nodes."
Below is an image to the method of my schematic madness. This image shows how I organize my nodes so that it helps to minimize any confusion.
Click here for full size

5. Setting up the collision for the debris pieces is a little time consuming but necessary. Basically create a collision volume for each individual debris piece. There are four different types of collision volumes that Torque recognizes (colbox, col, colsphere, colcapsule). Their naming convention should be set up like, colbox-1, colbox-2, colbox-3, or col-1, col-2, col-3, etc. For each collision volume, there will need to be a collision marker as well. These collision markers will also need to be linked to the base node, as shown in the image under step three.
colbox is used for box object collision
col is used for irregular shaped collision (Make sure that non of your collision volumes are concave)
colsphere is used for spherical shaped collision
colcapsule is used for cylindrical shaped collision
Each of these types of collision can also be used together. Like if you had a debris piece that uses a box collision, a piece that uses an irregular shaped collision, and a piece that uses a spherical collision, the naming convention would be something like, colbox-1, col-2, colsphere-3, etc.
*Also, for the collision volume names, you must use a dash (-) instead of an underscore (_) between the collision name and numerical value. For example, colbox-1 will work, but colbox_1 will not work.
*Create two layers in your layer manager for both states of your broken mesh collision volumes and collision markers. The amount of broken mesh collision volumes and markers are high in number so it's better to save all of them into their own layer. I usually save the base collision volumes and markers within the base layer and I do the same for the unbroken mesh, collision volumes, and collision markers.

6. Next we need to create the LOD helpers for the debris pieces. Create as many dummy helpers as you have debris pieces and link all the new dummy objects to the start node in the schematic view. These LOD helpers can be any size and placed at '0.0' in world space. The naming convention for the LOD helpers can be whatever you like as long as the final letter in the name is not numerical. For example, I usually name my LOD helpers as, lod-helper01A, lod-helper02A, lod-helper03A, etc.
7. To set up the LOD for the debris pieces, you will need to clone all of your debris meshes using the 'copy' method instead of the 'instance' method. The naming of these cloned debris pieces should coincide with the same pieces they were cloned from. For example, the clone of fence_bk_A_one100, should be named, fence_bk_A_one10. Again, the suffix number will be determined on the detail node's LOD distance that you are comfortable with. Now you will link both versions of the debris pieces and the collision to the LOD helpers as shown below. You can use the same collision for both of the debris meshes. Also if you look at the image below, I kept the nodes and mesh names organized by using either 01, 1, one, and 02, 2, two, and so on.
*Both steps, 5 and 6, will need to be repeated for the second state as well.
*In your layer manager, make sure that your cloned debris pieces are saved into the same layer that your broken debris are in. Also, I usually put the LOD helpers within the same layer that the broken collision is in.

8. Now we can setup the rest of the hierarchy for both states (Refer to the image under step 3 to see how I layout both states with their own torque nodes). For the unbroken version of the mesh, link all of the collision pieces to the unbroken mesh and then link the unbroken mesh to the start node. Notice in the image below that the collision markers for this branch of the hierarchy are the same amount as the collision volumes for the unbroken mesh. Next step is to do the same for the base mesh and it's collision volumes. Link all the base collision volumes to the base mesh then link the base mesh to the start node.

9. Now that everything is linked correctly and named correctly, then it is time to export the meshes. This is where the layer manager comes in handy. If you set up everything into separate layers, then exporting shouldn't be a painful process. First unhide only the layers that you want to have exported. For example, if you are exporting the broken meshes, then you will unhide only the broken mesh, broken collision, and torque nodes layers. Select everything in the viewport and confirm that you have all the correct meshes and nodes selected in your schematic view. Once these are selected, then choose 'Export Selected' and specify the directory you would like to save into and at the bottom of the export window, expand "Save as type" and choose "OpenCOLLADA (*DAE), then give it a filename.
*For the LOD parts of the broken mesh, you will need to determine which parts of the debris pieces are small enough to LOD sooner than the larger pieces. Once you know which ones you would like to LOD out first, select all of the broken debris pieces along with the collision volumes, collision markers, and the LOD helpers along with the torque nodes. Then unselect the small debris pieces that you decided to have LOD first and export your selection.

My exported filenames for this example are:
fence_1_bkbase_a.DAE is the 1st state base mesh.
fence_1_bkbase_b.DAE is the 2nd state base mesh.
fence_1_bkstate_a.DAE is the 1st state of debris.
fence_1_bkstate_b.DAE is the 2nd state of debris.
fence_1_unbk.DAE is the unbroken mesh.
10. Now that you've saved the collada files, the next step is to set up the datablocks within the physicsShape.cs file. You can edit this with notepad. Below is the setup for the pier pieces. Just scroll to the bottom and enter the information using your filenames. Also, the areas for the "PhysicsDebrisData" and "PhysicsShapeData" will need a unique name that you will use in the Datablock Editor in the Torque Engine.
_______________________________________________
// fence 1 broken state A
datablock PhysicsDebrisData( PSfence1Adebris )
{
lifetime = 60.0;
lifetimeVariance = 0.0;
velocity = 0.1;
velocityVariance = 0;
shapeFile = "art/shapes/physicsShapes/fence_1_bkstate_a.DAE";
mass = 1.5;
dynamicFriction = 0;
staticFriction = 0.3;
restitution = 0.0;
linearDamping = 0.1;
angularDamping = 0.1;
linearSleepThreshold = 1.0;
angularSleepThreshold = 1.0;
waterDampingScale = 10;
buoyancyDensity = 0.8;
friction = "0.2";
};
datablock PhysicsShapeData( PSfence1A )
{
category = "PhysicsShape";
shapeName = "art/shapes/physicsShapes/fence_1_unbk.DAE";
mass = 0;
debris =PSfence1Adebris;
explosion = "SplinterExplosion";
friction = "0.1";
linearDamping = "0.1";
angularDamping = "0.1";
buoyancyDensity = "0.2";
staticFriction = "0.1";
restitution = "0.3";
invulnerable = "0";
minDamageAmount = "0.5";
destroyedShape = "PSfence1B";
};
// fence 1 broken state B
datablock PhysicsDebrisData( PSfence1Bdebris )
{
lifetime = 60.0;
lifetimeVariance = 0.0;
velocity = 0.1;
velocityVariance = 0;
shapeFile = "art/shapes/physicsShapes/fence_1_bkstate_b.DAE";
mass = 1.5;
dynamicFriction = 0;
staticFriction = 0.3;
restitution = 0.0;
linearDamping = 0.1;
angularDamping = 0.1;
linearSleepThreshold = 1.0;
angularSleepThreshold = 1.0;
waterDampingScale = 10;
buoyancyDensity = 0.8;
friction = "0.2";
};
datablock PhysicsShapeData( PSfence1baseB )
{
category = "PhysicsShape";
shapeName = "art/shapes/physicsShapes/fence_1_bkbase_b.DAE";
mass = 0;
invulnerable = "1";
};
datablock PhysicsShapeData( PSfence1B )
{
category = "PhysicsShape";
shapeName = "art/shapes/physicsShapes/fence_1_bkbase_a.DAE";
mass = 0;
debris =PSfence1Bdebris;
explosion = "SplinterExplosion";
friction = "0.1";
linearDamping = "0.1";
angularDamping = "0.1";
buoyancyDensity = "0.2";
staticFriction = "0.1";
restitution = "0.3";
invulnerable = "0";
minDamageAmount = "1.25";
destroyedShape = "PSfence1baseB";
};
_______________________________________________
11. In the Torque engine's datablock editor, you will need to specify the "destroyedShape" for each state. For the 1st state, my PhysicsShapeData name is "PSfence1A", and for the 2nd state, my PhysicsShapeData name is "PSfence1B". Also, for the final base PhysicsShapeData name, I used "PSfence1baseB". So in your Datablock LIbrary, choose your first state physics shape and scroll down to the Media area and under "destroyedShape" choose your 2nd physics shape from the drop down. Next, back at the top, choose the 2nd physics shape and scroll down to the Media area and under "destroyedShape" choose your final base mesh.

12. Now that the datablocks are set up for multiple states of destruction, go into the Object Editor and navigate to the physicsShapes directory and double click on the 1st state physics shape to place it in the level. Next throw a grenade at it, then once the debris settles, throw another grenade at it for the final destruction.
I was told that you can have as many multiple states of physics shapes as you want, but I haven't set one up past 2 states. If you do set up more than two states, then the additional states would basically be created the same way as the previous two states.
Also, you can specify the type of damage to each state by tweaking the "minDamageAmount" under the "Dynamic Fields" category in the Datablock Editor. For example, I set the "minDamageAmount" for the 1st state to low number so that gunfire destroys it and I set the "minDamageAmount" for the 2nd state to a higher number so that only grenades destroy it.


#2
For Max users wanting DTS export:
considering the size of model's Hierarchy exported here...I have to mention that the default GG Max2DTS exporters only export 20 detail markers.
- You may want to download and use these exporters which allow up to 100 detail markers for DTS shapes.
->>>> For Max 9,2009,2010,2011 grab the file package dated: "22-Jun-2010 22:41" (these have fixed LOD settings)
08/14/2010 (12:50 am)
(pulled over from other thread)For Max users wanting DTS export:
considering the size of model's Hierarchy exported here...I have to mention that the default GG Max2DTS exporters only export 20 detail markers.
- You may want to download and use these exporters which allow up to 100 detail markers for DTS shapes.
->>>> For Max 9,2009,2010,2011 grab the file package dated: "22-Jun-2010 22:41" (these have fixed LOD settings)
#3
TY :)
05/30/2011 (8:25 pm)
Can we get the original post duplicated to the artist forum perhaps? This information is very useful and needed as noted in this thread, http://www.garagegames.com/community/forums/viewthread/126147.TY :)
#4
05/30/2011 (9:45 pm)
Now I see why couldn't find it in the resources.
Associate Russell Fincher
Sickhead Games