How to make a projectile stay on ground level

I am implementing a Mario Kart like game. I decided to start with some of the fun traps that the original Mario Karts have. One of them is a turtle that goes in a linear direction and when it hits an opponent, the opponent is destroyed. I managed to get all this behavior done. However, I am facing an issue. My spawned actor (the projectile turtle) does not stay on the ground level. It starts going bellow or above the terrain (depending on the angle of the terrain). I would like to know if there is a way to make my projectile to always stay on ground level, and if so how to I do it.

There are several ways to do that.

I think the easiest way ist to decide for a fixed height, like 50cm aboth the ground. Then you do a Linetrace straight to the ground (0,0,1) and you will receive the current distance to the ground and position and so and. You can then say you want your objects z-coordinate (setWorldPosition) to be 50 aboth the hit point (be careful with world and local coordiantes)

If you want it more complex, you need the normal from the hitPoint and ou can set the angle of your shell accordingly.

I tried to do it like this

https://puu.sh/CgXIi/0c321d2a33.png

But the problem is, when the road is in a curving shaving (arc of circle), my actor (the turtle) goes immediately under the ground and gets destroyed (It’s the same thing if it’s a rising or falling slope)

You’re setting the actor location to be where your trace hits the road, whereas it should be a bit higher than that (unless your actor’s pivot is way down).

Moreover, you can try starting the trace not from the Actor Location point, but from a bit forward from that. Maybe that will help you be a bit ahead and scan the road beforehand.

P.S. How did you add the screenshot with no link? It’s impossible to see in fullsize.