How can we access the faces, triangles or vertices of a (collision) mesh? I’m trying to do a single line trace and find the actual face that was hit. I need to know if the line trace was close to the edge of the face or not. Can I do this?
I saw that FHitResult has a FaceIndex, but that seems to be used with complex collisions only.
Did you try the Get Closest Point on Collision node? To be honest I don’t quite understand how it works, but it looks like what you are looking for.
Here is the node reference:
And here is the C++ reference of a similar function made by Rama, which might be related or be the origin of that node:
It even looks like Rama’s function returns not only the actual point, but the distance to it as well, so by comparing that to a threshold the original poster might have known if it was close to an edge.
Now, for sbbg, leaving a bullet hole is easier done by spawning a decal at the hit location of an on hit event or a trace, and attaching the decal to the actor in case it is a moving object.
Changing the color of the faces I think would imply that you have a dynamic material for each face. To do so in a single material would mean you are writing info to a texture inside a material. That is possible by using a CanvasRenderTarget2D, but judging by what I have seen on other threads, what is not currently possible is getting the UV coordinate corresponding to a given vertex, so you wouldn’t have the information needed to know where to draw on the texture.