2
Vote

Simple Mesh collision testing

description

Implement a method on Model/ModelMesh similar to ID3DX10Mesh::Intersect.

comments

walbourn wrote Nov 12, 2013 at 6:28 AM

D3DX's Mesh Intersect performed the following test.
  • Perform a ray-hit test against the bounding box of the mesh. If it missed, no hits. If it hit, further processing.
  • Allocate an array of Booleans with the same number of entries as the maximum vertex index in the mesh.
  • Generates a plane containing the test ray, and store if the vertex was 'in front' or 'behind' that test plane.
  • For each triangle in the mesh, first check to see if all vertices in the triangle are on the same 'side' of the test plane by looking in that array. If they are, skip testing that triangle because it can't hit the ray.
  • Compute triangle hit test. All hits are stored in an array in sorted order.

walbourn wrote Nov 12, 2013 at 6:35 AM

D3DX mesh maintained both a STAGING and DEFAULT version of the VBs/IBs so it could use the STAGING buffers to read the data. Implementing this will either require a similar solution or a cache of collision geometry (just the positions).

walbourn wrote Jul 24 at 6:49 PM

This is related to work item 1208

walbourn wrote Today at 7:48 PM

Need to support both Model and GeometricPrimitive