I still cannot get the material that has been painted on the landscape. I have looked at old forum entries that seem to have succeeded, but none give complete descriptions of how to do it. I set up the following in my character blueprint from an old forum entry that I assume worked, and I think I have the same logic, but I do not get a material name.
From your setup there isn’t much to go on, though everything looks fine so the problem must be elsewhere.
I believe you are watching the same tutorial as I’ve back in the day and if so then you should have a working example which I can confirm works as shown. Unless you’ve found just an images on the forum… if that’s the case here is the full tutorial Unreal Engine 4 Tutorial: Footstep Sounds (english) - YouTube.
So, the major issue is that you have a new line-trace every notify.
This would Add onto whatever other line trace you have that handles the Foot IK for instance.
It would be preferable to set the surface type into a variable on the character BP based on the IK info (if you use IK).
Aside form the overhead issue
-
Do you have a Physical Material assigned to the landscape layer?
To assign it - with the physical materials created, open the Landscape Layer Paint location, double click the layer to open it, assign the Custom Physical Material. -
Do you have the Physical Surface set up in Project settings?
No? Open project settings, find Physics, scroll down to Surface, create your layers. -
Does your Physical Material have a Surface Type assigned to it?
No? Open the Physical material and assign the correct surface type to it.
Assuming you address either one or all of those points, Get Surface Type will start working.
BTW, you can also get the Phys Mat and check the Name of it - bypassing all the 3 steps but relying entirely on the line trace hitting something with a Phys Mat defined.
I have no animation set up as yet. There is no point if I do not get this material issue solved. Until then, I will live with the overhead of doing the trace every tick.
I have a grass and gravel plysical surface type set in the project settings. I have a grass and gravel physical material created with the corresponding surface types set. I have a landscape layer ‘LayoutPaintLayerInfo’ created with the grass physical surface specified. Do I need a landscape layer for each surface material?? I do not know how to use more than one landscape layer. Then how do I paint on the landscape?? Does the painting of various materials on the landscape reference the corresponding landscape ‘layers’, such that I need a ‘landscape layer’ for each material that I want to point??
I have looked at the tutorial and will make certain my blueprint has the same logic.
Please let me know about the layers. I have just painted the two materials on the ‘landscape’ as a whole without knowing about paint layers.
Thanks.
Actually, I am going to create a new landscape layer and new layer info objects, and repaint; as well as recreating the material trace portion of the blueprint; and see what happens…
OK. I did create a new landscape and gave it a base grass material, and I now the trace gives me ‘grass’ as the material. So, that works… However, I must have changed something else because the 2 layer info targets for painting now have a ?mark and they do not paint.
Finally, I guess I got all the data correct and all off the following blueprint works. I have defined Engine->Physics->physical surface types, have physical materials with surface type set, have layers in the landscape material set on the landscape, and the physical materials set in the layer info’s.