Collision mesh

From Valve Developer Community
Revision as of 08:58, 24 March 2009 by Vanillachicken (talk | contribs)
Jump to navigation Jump to search
A static collision mesh (red wireframe)
A jointed collision mesh (yellow wireframes)

A collision mesh (sometimes collision model, though it is actually only ever a component of a model) is a cheap 3D mesh used by Source to calculate VPhysics collisions.

A collision mesh is not visually represented to the player, and should be extremely low-detail compared to any reference or LOD meshes - see the images to the right for two examples. The lack of precision will not be noticed, except in that it doesn't grind the simulation to a halt!

In order to create an accurate collision mesh for a complex concave model, you'll need to create several individual convex objects. If they are not separated into multiple objects, the engine will treat them as one convex mesh.

Each object needs to be in a smoothing group (they don't necessarily need to be in separate smoothing groups) and have a texture applied. Since this texture will never be seen, it doesn't need to be present in the source folders.

No holes! - Unlike the visible mesh, the collision mesh must be solid on all sides. If during your compile you get an error similar to this "WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!" it means you either have a missing face or need to weld a vertex or two. It could also mean that one or more objects is not in a smoothing group. It's an oddly generic error.

See also

Template:Otherlang:en Template:Otherlang:en:ru