Projectile stay at ground level

Hello !
Could someone tell me how can we set a projectile to follow the ground level ;
I’m trying to figure out how to get or create a projectile that will hug the ground and go in whatever direction i shoot it at, but i’m not really sure how to go about keeping it on the ground and making sure that it stays at ground level even when going upslope or down slopes etc. Any help would be appreciated

Do you intend to have any physics involved at all? Like it would eventually fall?

Or you mean that the projectile always stays at the same elevation relative to terrain until it reaches its target?

Does it only go in the direction fired, or does it track target at all?

If it is only going in direction shot but should conform to terrain, my first thought is just set a constant velocity in fired direciton, and then on a timer run a down facing line trace to get distance from terrain. Just set world Z location to account for any difference from your desired height.

To smooth it out, you could use a spring arm with lag enabled that the projectile is child of, and actually update that spring arms world location. Or you could just update the location at a fast interval (or even on tick) for smoother movement.

If it needed to home, you’d need to update the rotation and velocity using Find Look at Rotation - though there’d be a bit more involved than that.

I would like for it remain at the elevation of the terrain and have a little tracking to it’s target

What would be the more involved part of the homing projectile?

its not really that complicated but it wasn’t involved in the original question so I didn’t want to sidetrack if not necessary.

There is actually built in functionality for homing in the projectile movement component. That might be easiest method - just use that, set a constant velocity, and manually override the elevation.

tons of step by step guides for homing projectiles out there already - I’d start by skimming through a handful to see multiple takes and then you can choose most appropriate given your situation.

Been trying to figure it out on my own and maybe i’m just not understanding it or i still lack alot of knowledge on the system but i haven’t found a way to change the elevation. Could you show me what you meant or where that part would be?

I think just setting the world location Z value should work.

If you need it to stay in relation to the ground then it would be more complicated - you’d need to line trace to the ground and work in relation to that. So you’d need to add your desired offset to the ground hit location.

It may be easier if you break it up into smaller chunks. Like for this part you could make a new character, give it a static mesh component, set that to a sphere primitive.

Give it a constant movement input, and then practice setting the world location of the static mesh to be offset with the landscape (or whatever is underneath).

The character movement component has a Get Floor node which does the line trace already for you if you want to cheat a bit just to get the basic idea. However if you end up doing this on a non-character based actor, you’ll have to do a downward linetrace yourself.