How can i get the material of the trace hit ?

This is really important to me and i can’t find where to do it. I don’t wanna create extra meshes just to know where the object got it.

And what is that supposed to be ?

Add a physical material you can break that from the hit results

I’v thought about that but i can only assign 1 physical material per object, so it doesn’t help me at all.

I don’t know if that is possible, it seems like it would make more sense either way, to construct your object from different components. In the long run you’re going to have a lot more flexibility and reference ability if you use them, so many functions regarding traces and hits and overlaps already give information about components they hit. If you used components you’d be tapping into the already sufficient built in system, rather than trying to do what you’re doing with materials.

You can get the materials array, but you cannot get which material you have hit. This means you will have to use a single material per component.

you can set the physical material per MATERIAL you assign you do that in the material setup since you seem to use multible materials this should be the best way to deal with

Thanks everyone for the advices, i ended up making multiple components for trace hits. ruohki i will check it again, probably missed something.

first of all Break Hit Result from LineTrace and get FaceIndex , Hit Component

then you need function Get Material from Collision Face Index
you can get from it value (and name) of hit material, then just check all materials with the same name.
In the end you get index of this static mesh, that you can change in the future.

This FaceIndex is a new thing thanks for pointing that out!