Skip to content

Type Alias: MeshPickElement ​

ts
type MeshPickElement = 'object' | 'instance' | 'vertex' | 'triangle';

Experimental

How generic meshes are resolved (WebGL2 has no gl_PrimitiveID, so triangles are derived from gl_VertexID):

  • object: one id per mesh (default for plain meshes),
  • instance: gl_InstanceID (default for InstancedMesh),
  • vertex: the provoking vertex (the LAST vertex of the rasterized triangle in WebGL). Its index is the geometry vertex index for both indexed and non-indexed geometry; for a grid surface it identifies one corner of the cell under the cursor,
  • triangle: floor(gl_VertexID / 3): exact for non-indexed geometry. Indexed geometry falls back to vertex (an indexed draw's gl_VertexID is the index value, not the draw position).

Released under the MIT License.