How would I teleport an actor to a random spot on the ground?

So as a first game to create, I thought it would be fun to try to recreate the horror game “Slender”. If any of you have seen it, you would know how the slenderman teleports randomly around the character. I think I could figure out how to do this, but what i’m asking is how would I be able to teleport it, and then snap it onto the ground? Since my map has bumps, if I just set the location to be a random spot around my character, I don’t want it to get stuck in the ground or be hovering in the air. Any help would be appreciated! Thanks!

You can do a line trace.

What a (single line trace by objects in this case) is doing is simply trying to draw a line from a start point to an end point. You can get a random point around your character, add the highest your ground will ever be (for example 2k or something) to it, plug that into start and then subtract another 500-1k from it as end point.

You will receive a hit result with the location where the trace hit onto something. If you do it by objects you can define what should be hit (for example ignore trees / leaves while still coliding with other environment stuff.

I hope this helps.

Cheers

Thanks for the reply! I’ll look up line traces and post back to let you know how it goes.

Well, how did it go?