check path on surface for elevation (ground tunnel effect)

Hey everyone,

firstly a quick description of the result I’m trying to achieve with this and the problem I want to avoid:

I want a ground tunneling effect to appear along a path starting from behind the player and move into the distance in view direction.

the problem I’d like to avoid is the effect appearing on slopes or hills, it should only appear on flat areas.

What I’ve got right now is two painted layers on my terrain that I’ve linked physical materials to which I’m checking for in a raycast: “allowed” physical material in flat areas and a “forbidden” physical material in sloped areas.

I can test a start and endpoint but I’m not quite sure what the best approach for checking along that path is, or even inside a view cone area.

any pointers would be appreciated! :slight_smile: