Get more mesh info about collisions / line traces?

I need some additional info about impacts, so I can determine the involved materials and custom(!) parameters I want to define for them. Physical materials come close to what I need, but there’s 2 problems: the “surface” system is limited to 62 enum values, but a pointer to a kind of custom material descriptor would be what I’m looking for. And the other big problem is that it doesn’t seem like you can set/change the physical material in dynamic material instances, but I need that kind of flexibility.

There’s a number of things I could make use of, but I don’t know how to get any of them. Mesh section, render material, vertex UVs or colors would all do fine. Any ideas?

There’s a number of things I could make use of, but I don’t know how to get any of them. Mesh section, render material, vertex UVs or colors would all do fine. Any ideas?

Mesh section: You can get FaceIndex directly from the Hit Result. This means however, that you should have some kind of mapping of each face index to a desired material beforehand but you will be able to modify the mapping run-time.

Render Material: You can get the HitComponent and then get it’s material (assuming it is a mesh of some kind). I am not entirely sure how to handle different material blending.

UVs: You can either use FindCollisionUV() or the Find Collision UV node but keep in mind that you have to enable “Support UV From Hit Results” in Physics Settings.

I have not tried these myself but I hope they somehow help.

I didn’t think FaceIndex could be of any help, because it says that it’s meant for landscapes and such. So, if it’s simply the index of the triangle and gets provided for all meshes (not just landscapes), that would actually be perfect! I can determine the section/material and any vertex data from that, as well as any custom data I want to connect it with. I will look into that. Thanks for the info!

It’s probably not that simple after all. I need this mostly for skeletal character meshes and tracing against the actual render tri-mesh must be very performance heavy, if it’s possible at all.

Landscapes simply have conveniently indexed faces. There is a node introduced in 4.16 that can get the material from a FaceIndex. Check this out: 4.16 Release Notes - Detech Material on Mesh Surfaces - YouTube

That might become useful for static meshes. For skeletal meshes I guess I’m stuck with rough approximations via hit-shapes. And instanced static meshes are probably gonna be trouble again, too…

You don’t know of a way to set a physical material at runtime by any chance?.. Since my materials are based on a kind of substance-mask to allow procedural combination of different material-textures, it’s hard to define a physical material in advance. I would have to create tons of MICs for each base-material to derive MIDs from, one for every possible physical material. It would be so easy, if I could just set it dynamically.