I am currently using LineTraceByChannel to select an object in my scene and change the material, some of these objects have multiple material elements, is it possible to retrieve the element id that is hit?
I can change it fine as long as I assign a pre determined index. I’ve tried to use the hit item directly into the element index (no result) and also tried putting the hit item into an integer variable before trying to attach it to the element index
There is an element ID, that is what I need to retrieve. If I had a chair and the legs were element Id 0 and the seat was element Id 1,i want to determine which element I’d I hit with the line trace so I can change that material associated with that element ID.
Looks like this only works with set physical materials, not rendering materials. Phys Mat always returns “None” so it never matches and just runs through the all indices in the forloop. It does not seem like one can get the material element index out of the Break Hit Result node.
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 material index of this static mesh, that you can change in the future.