Is there a better way to check what I'm walking on?

I’m using a line trace to check the surface I’m walking on and play sound but if I’m standing on the edge of something I often get the sound of whatever’s below it. Also on my landscape there’s a large section of rock where I get the grass sound:

On the other side of the path I get the rock sound (or printed string telling me I haven’t set one up yet at least) so it’s not a layerinfo issue. Do I need to paint the landscape better even though it looks like it’s 100% rock?
The path up the cliff is also giving me the grass sound even though it should be default surface.

Also: I have timers that call a Step function to make sound and that function makes sure I’m not falling before making the sound (it seems easier than fiddling around turning the timers on and off when I jump/land in addition to when I start/stop moving). When I attach my Step function to the OnLanded event of my character, it doesn’t make a sound because I’m apparently still falling. I could pass a variable to that function call to make it skip that check but if there’s an option that makes more sense I’d like to hear it.

Hey Hallway.

It seems like you are using landscapes, correct me if I am wrong.

Getting Correct Sound
In landscape painting tool there should be list of layers, you can create and set the LayerInfoObject asset for each layer. Within the LayerInfoObject it has a physical material property which the Line Trace should return.

LineTrace should return the physical material of the most dominant layer at the hit location, so this should help with hitting the correct material.

Accurate Line Trace

To my knowledge you can set the distance of the Line Trace. Therefore you could set it to a small radius of your choosing, I would go from the feet and make a small Line Trace. This should mitigate standing over cliffs, bridges, etc… hanging over other materials.

Further Debugging

If this is not helpful, can you provide code snippets of how you are doing the Line Trace and how your level materials are setup.

Hope this helps!

I was in such a hurry to post this before bed I forgot to display the line trace which made it pretty obvious my mistake was setting the end to 0,0,-100 instead of subtracting 0,0,100 from my location…

It works pretty well now, I can even bypass the IsFalling check if I want since that distance doesn’t hit anything until I land or come close enough to landing.

I’m glad you were able to get it working :slight_smile: