Get Face Index from Vertex

Hi !

I’ve been messing around trying to come up with my own alternative to UGameplayStatics::FindCollisionUV() because it relies on a ‘face index’ from a hit result - something that only seems to be provided from ‘complex’ (per-tri) traces , which are not viable in my project.

So, I’m running a vertex-based solution instead and I’ve been hitting some limitations of that (UV accuracy degrades with mesh vertex count). My question then-

Is it possible to determine the index of a face on a mesh (from the UVInfo’s Index Buffer) , using a vertex on that same mesh?

Taking the indices from the mesh you for sure can go through all indices and find the triangles that belong to a specific vertex, and that is realy easy (just a performance question). But it is a whole other thing to determine the triangle that you are looking for.

First of I would calc the normal for each triangle and dot product it with the impact normal of the trace. Remove all triangles with a negative DotProduct (faceing away).

Then continue from there. Not sure how else to proceede if you only have a single vertex.

What is the UVInfo’s Index Buffer you mentioned?


It appears to be an ordered array of all the faces and verts belonging to that mesh. You can also find this array in the “LODRenderData” for Static / Skeletal mesh.