Apparently TraceHitInfo from all kind of trace returns the default physical material of the material/MIC instead of current Physical Material. This is reproducible by having a Dynamic Material changing it’s physical material during runtime, and then use a linetrace to returns it’s physical material. I’ve tested this both on C++ and blueprint with similar result.
I can confirm that the process ‘changing of physical material’ itself work by printing the current physical material of the material. I believe this had to do with the getSurfaceType function.
I was able to replicate the issue internally and have entered a bug report as UE-25200. As we investigate a solution to this issue I will keep you informed here.
Thank You for your assistance tracking this issue -
I can see that this is confusing, but it is expected at the moment, and I’m not sure of a good way to fix it. The physical material is stored on the collision body, so when you change the PhysicalMaterial on the MID, the body needs to be updated. Unfortunately we don’t have a mapping of all bodies using a particular MID, and updating all of them could be very expensive. The best workaround is probably to call SetMaterial again on the afftected component, which will update the collision info. Or you could manually query the material and then physical material on the object, rather than using info from the HitInfo.
oh … so setting the material again would work ? if that’s the case i would try that.
as a suggestion , I would suggest that perhaps the system could update the component when the physical material is being set. Or if that wouldn’t work, maybe it could set the material again when the physical material is being ‘set’.
Yes setting the material again should work. The problem is the engine doesn’t track all the components using a particular material, so it doesn’t currently know which components to update when a material changes. We’ll give this some more thought…
still see this issue on static meshes in 4.23 (also 4.25) (skeletal and BSP returns right material).
in 4.23 (also 4.25) i have found that if you ONLY assign physmat in material settings - only then it works
if you assign in staticmesh or staticmesh component, in BP or level instance - you always see default phys mat.
but the most strange thing that is another project based on 4.23 (also 4.25) where everythings works fine.
so, can it be any config setting? editor setting? engine setting? (or something simillar)