How to get the correct material on Hit?
i am currently working on the Bullet impact effects and sounds when hit physics materials. It works well on my Static Meshes that have only one Material. However, if i have Multiple Materials in my Meshes it only returns the First Material. For Example, i have a Wall element with 2 Different Materials, Wood for the Wall itself and Glass for the windows. It would only return Wood.
How do i get the correct material when hitting with traces? Like i said it works well with other Meshes that have only one Material. But if it has multiple Materials it returns just the first Material Element in the list i think...
asked May 25 '16 at 01:24 PM in Blueprint Scripting
You need multiple collision primitives for that. Visual materials are applied to visual mesh. RayCheck and similar functions operate on collision meshes, not visual meshes. You could try SimpleFromComplex collision, perhaps if the trace is done against actual geometry you will get individual physics materials assigned to visual materials.
answered May 25 '16 at 02:44 PM
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 material index of this static mesh, that you can change in the future.
Follow this question
Once you sign in you will be able to subscribe for any updates here