Planet gravity/mass and slingshot mechanic

Hey, long story short:
Slingshot technique is a way for an object (like a ship) to use the planet’s gravity to accelerate to another location:

What I’m trying to do is basically that.

I had the idea of just adding gravity to a planet and increasing speed when the player’s ship flies in the trigger (still not sure how, but it sounds easier than making an actual slingshot mechanic. I’ll figure it out I guess?).

In any case, any ideas? Thanks

planetary gravity