Collision mesh: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 28: Line 28:
# Build a collision mesh out of primitives such as boxes and cylinders. You may collapse to editable mesh and move points around, but don't delete any faces or create any holes.
# Build a collision mesh out of primitives such as boxes and cylinders. You may collapse to editable mesh and move points around, but don't delete any faces or create any holes.
# Use the Attach function to combine every part into a single editable mesh.
# Use the Attach function to combine every part into a single editable mesh.
# Select each element of the editable mesh and assign it a unique smoothing group. All hard edges on the model will disappear.
# Do NOT weld vertexes together after using the Attach function. All objects within the mesh should be individually selectable using the "Select Element" option within the Edit Mesh modifier.
# Export the collision mesh as a .smd.
# Select every face in the mesh and set them all to a single smoothing group, i.e "1"
# Export the collision mesh as an .smd.


== See also ==
== See also ==

Revision as of 19:34, 17 September 2009

Template:Otherlang2

A static collision mesh (red wireframe)
A jointed collision mesh (yellow wireframes)

A collision mesh is a cheap 3D mesh used by VPhysics. It is sometimes called a collision model, after the C++ object that loads it into the engine, but as far as creating models is concerned it is a vertex mesh more or less like any other.

Collision meshes are invisible, and should be extremely low-detail compared to the model's visible components (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!

Caveats

  • Collision meshes must be convex. To create an accurate collision mesh for a concave model create multiple, separate convex objects, intersecting them if necessary.
  • Each face on a given convex object must share a smooth edge if it is to be exported to a collision mesh.
  • Unlike a reference mesh, a collision mesh must be solid on all sides. Errors similar to "WARNING: Model has 2-dimensional geometry" mean there is a missing face somewhere.
    Tip.pngTip:This can happen if two convex objects become merged; in 3DS Max ensure you have applied at least one smoothing group before exporting.


XSI Procedure

  1. Build a collision mesh out of primitives such as boxes and cylinders. You may move points around, but don't delete any faces or create any holes.
  2. Select every part of the collision mesh and use Model -> Create -> Polymesh -> Merge to combine them into one object.
  3. Use Render -> Get-> Geometry Approximation. In the Polygon Mesh tab, uncheck Discontinuity: Automatic. All hard edges on the model will disappear (See image below).
  4. Export the collision mesh as a .smd.
A collision mesh created in XSI 6.01. The reference mesh has been moved aside for visibility.

3DS Max Procedure

  1. Build a collision mesh out of primitives such as boxes and cylinders. You may collapse to editable mesh and move points around, but don't delete any faces or create any holes.
  2. Use the Attach function to combine every part into a single editable mesh.
  3. Do NOT weld vertexes together after using the Attach function. All objects within the mesh should be individually selectable using the "Select Element" option within the Edit Mesh modifier.
  4. Select every face in the mesh and set them all to a single smoothing group, i.e "1"
  5. Export the collision mesh as an .smd.

See also