Can you query landscape layer info?

I am building a system similar to foliage only with blueprints, interactable spawners, and real time rather than in editor. I want to be able to query the landscape for what layer a collision is on. I can get the hit from the raycast, determine if it is a landscape, but from there, I see no way to query the landscape for the layer info to determine if a certain layer was hit (or rather if a certain layer’s blend weight at that UV point is high enough, etc).

Anyone done anything like that before?

1 Like

You can specify in your trace if you want to get the physical material of the hit component on the FCollisionQueryParams structure:

 FCollisionQueryParams TraceParams(FName(TEXT("")), true, this);
     TraceParams.bReturnPhysicalMaterial = false;

Then, on the Layer Info for your terrain, you can associate it a physical material. That way, you know on what kind of terrain you hit!

Since you are in Blueprint, the Out Hit pin, will have a Out Hit Phys Mat you can use to do the same thing.

41817-linetrace.png

1 Like

Can we get layer weight, Michael? Thanks!