Raycast to the edge!

Consider this : 2 triangles in a same plane and we trace to the point at the shared edge of them. So there the location & normal vector can’t tell us which triangle was the choosen one.

How can I get the barycentric coord?

Edges are non-excistant in a virtual world. First of all, it’s very unlikely that you will ever have a raycast hit EXACTLY the edge between two triangles, without previously knowing you were doing so, and second if that would be the case, the trace (raycast) would simply return the triangle it calculated first. I don’t think there is an inbuild way to receive what you want.

When you want to implement something like, a bullet hitting the edge of a triangular shape and want it to bounce straight back instead of to one side of the triangle, you would have to include a small face (quad) on the “triangle” mesh on the “shared edge” (which then of course is no perfect edge anymore)