How to "Get texture at location" on landscape?

Hey, I would like to get information about which texture is used at a specific location of a landscape.

So I want to be able to know whether there is grass or dirt or anything else. It should be used for letting the player place certain buildings only on ground where for example is grass or stone.
You know, you cant really place a farm on stone, while you also cant place a quarry on dirt.

I don’t want to have to place other objects in the editor for marking where specific “resources” are, because it would be a pain to really keep this synchronous with the applied texture to the ground. It should really just depend on the texture.

How can I do this? Any help is appreciated :slight_smile:

Not sure if you need exactly texture, but you should be able to receive physical material when raycasting against landscape. You can set different physical materials per landscape layer (dirt, grass, stone etc).

In landscape painting tool there is should be list of layers that landscape uses, you can create and set LayerInfoObject asset for each layer. LayerInfoObject has physical material property.

LineTrace should return physical material of most dominant layer at hit location.

If I could set different materials per layer, that would be great, then just receiving the physical material would work, but if two materials would overlap (which happens quiet often on landscape) which one would the trace return?
And how can I set actual different materials per landscape layer? I only know I can set different textures for the layers all in one landscape material (which is returned by the trace).

It works! Thanks!