I found a way to get the material from the Face Index with line tracing. I want to do the same with component hit but Face Index always returns 0.
I’m using a static mesh and have set it to complex collision but the result remains the same.
When you trace, you always trace against components since actors have no collision capability. Hits Results return Actors references because the component they own was hit.
I mean, the component hits and trace hits share the same Hit Result output. I thought that if the material index can be obtained by line tracing, it can be obtained by component hit in the same way.
But for some reason it didn’t work…
Not sure what you mean by this. There’s nothing to be shared, it’s a struct containing trace result data, nothing more.
In the anim above, the Face Indexes are returned correctly when the trace hits a component - is this not what you’re asking about? I followed up on this:
As you say, the structures were the same so I would have thought that the material index would be obtained in the same way. Because I thought they were returning the same type of information.
But the Face Index is still 0. I’ve tried this with complex and simple collision on both the hitter and hit side, but nothing works. I don’t intend to use line tracing.
And that’s where our wires crossed. My bad. What generates this collision event? In case of physics, for example, the collision would not return Face index - that’s afaik. Since it revolves around simple collision only. Technically, you should be seeing -1, rather than 0.
I feel you will need to perform an additional complex line trace based on the initial hit.