Jump to content
Official BF Editor Forums

Collision Meshes Explained (read even if you think you know)


Recommended Posts

There has been some confusion over what each of the collision meshes does. I have to admit that I've even given out conflicting information. The trouble is that the meshes for BF2 are not the same as for BF42 and at sometime I too got them confused.

Here is the definitive answer on Collision meshes for StaticMesh objects:

Col0 - projectile mesh. This is used to determine where bullets and all other projectiles hit.

Col1 - Vehicle mesh. This is used in vehicle-to-vehicle collision calculations.

Col2 - Soldier mesh. This is used to determine player collisions.

Note that I had previously gotten Col1 and Col2 mixed up and had at various times reported them in opposite ways. This info replaces anything I've previously said!

Another interesting thing I discovered:

In order for Col2 to work, most of it has to be the same as or inside the boundaries of Col0.

Why this is:

When you import an object into the Editor (or export from Max), an invisible bounding box is created and added to the mesh file. The vertices of Col0 are used to determine it's dimensions. If most of Col2 happens to be outside this box, it's ignored and the player can just walk right through the object. Something to remember if you are trying to do some custom collision work and you have this problem.

My testing procedure:

If you would like to confirm this, you can try this for yourself. Here's what I did:

1. Create a box. Make it 2 meters on each side so that it's easy to see.

2. Make sure that you have reset all transforms, then copy this box to make Col0, Col1, and Col2.

3. make sure that you've assign a material to all the collision meshes and that you've textured the visible box with a proper staticMesh cgfx shader.

4. Assemble the hierarchy as usual and save this as "TestBox".

5. This is now your basic test case. Bring it into the editor and make sure you assign a material to it in the "default" tweak tab. (I used Wood_thin so that I was sure to see an effect when I shot it.

6. Place it in a test map, do a "Save-All", package your map, and test.

Confirm that you did everything correctly and that it works the way it should.

7. Back in your modeling program, open up the TestBox scene again and scale Col0 up by 4 (or 400% if you are using Max).

8. Reset the transforms and make sure you change the name of the object and the anchor in the hierarchy to "TestBoxZero". Note that I spelled out the name rather than using the number.

9. Save this scene as TestBoxZero (in case you need to come back to it later) and bring this new object into the editor.

10. Make sure you assign the same material to it in the Editor again, place in the map a ways away from the first one (make sure you can easily remember which is which).

11. Save and package your map and test again.

This time when you shoot at the box, you should see the bullets hitting the invisible larger cube. You should still be able to "touch" the visible surface when running up to it or driving into it. This proves that Col0 is for projectiles only.

12. Open the ORIGINAL TestBox scene again.

13. This time scale up ONLY Col1 and save the scene as TestBoxOne.

14. Repeat all the above steps to add this new box to your map and test. (Again make sure you can remember which box is which!)

This time you should find that when you shoot the box, the bullets hit the visible surface, but when you drive up to it, you collide off the invisible Col1 mesh that is larger than the box. If you walk up to the box, you can still touch the visible surface. This proves that Col1 is used by vehicles.

Now the tricky bit:

15. Repeat the above procedure once again opening the ORIGINAL TestBox scene and this time scale up ONLY Col2. (It's very important that Col0 and Col1 are the same size as the original box!)

16. Save the new scene as TestBoxTwo, be sure to assign the wood material again once you get it into the editor, then place and test again in your map.

This time your bullets and vehicle should both hit the visible surface, but when you walk up to it, you pass right through. This is because Col2 is bigger than the bounding box, which is calculated from Col0.

17. Open up TestBoxTwo again (not TestBoxZero) and scale Col0 up so that it is slightly larger than Col2 (or copy Col2 and rename it Col0, deleting the old one).

18. Remember to reset the transforms, check your hierarchy, and rename all relevant pieces with "TestBoxThree" this time (so the editor doesn't get them confused)

19. Test again.

This time your bullets will hit the invisible Col0 mesh, your vehicle will still hit the visible box, and you will walk into the invisible larger Col2 mesh. This confirms that Col2 is used for soldier collisions and that it has to be the same as, or inside, Col0 for the bounding box to work.

Incidently, if you are doing some kind of custom collision mesh work and you need your invisible soldier collision mesh to be bigger than the rest of your object, you can make this work by adding a few tiny, single polygons to Col0 and moving them out past the edges of Col2. They just need to be there so that the bounding box that's generated ends up being bigger than Col2. You don't evidently even need to add them on all sides. It appears that just the majority of Col2 needs to be somewhere "inside" the limits of Col0.

Confusing? most of the time, you'll just have to experiment when doing this. Most of the time you just need to know the rules and you should be fine.

Note that this is for staticMesh objects and vehicle hulls. Wheel collisions work slightly differently and just need Col0 and Col1.

Note also that you don't have to have all three collision meshes on all parts of a vehicle. this is usefull for things like gun barrels in turrets. You might want projectiles and maybe soldiers to collide with the piece, but there's no need to add a vehicle collision mesh to the piece because it would just cause lag from all the calculations and wouldn't really be noticeable anyway.

I hope this clears up any confusion. Note that I may have this info stated wrong in some of the tutorials. I'll try to get them updated when I can, but this is the collision that should be used and supercedes anything I've said in the tutorials.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
  • 5 months later...

Wow, I didn't even know that, I wondered why my bullets kept disspearing into nothing and wouldn't have any effects...

BTW I also didn't know there was a col3 file...for AI/Bot support, nice find Panzaman

Link to comment
Share on other sites

Wow, I didn't even know that, I wondered why my bullets kept disspearing into nothing and wouldn't have any effects...

BTW I also didn't know there was a col3 file...for AI/Bot support, nice find Panzaman

You can have a look at what they're like in the Editor if you want - it's one of the render options. They only apply to statics, though - they're not required for vehicles.

Edited by [BG2]Panzaman
Link to comment
Share on other sites


  • Create New...