Super Mario Galaxy jumping

Alright, here’s a convoluted situation:
(See 3D world spinning with Mario on a planet moving around the planet and the camera following him, only this is in 2D so it’s easier to figure out…kinda)

Pretend I’m playing 2D super mario galaxy. How do I jump?
I’ve tried to use collision, raycasting, booleans, all to no avail because the ground is somewhat uneven and the ground doesn’t always register according to the player; sometimes the player is allowed to jump while moving, sometimes he isn’t. Additionally, how do I figure out the current player’s ‘y’ axis and apply force/velocity in that direction? Especially if it moves, there’s no fun way to keep the velocity going in that direction; it’ll try to apply it in the same given direction, and things get messy.

Current implementation includes using AddForce to ground the object, but when jumping applying velocity in the y direction.

Unless I’m doing something wrong, I’m all out of ideas, so help would be greatly appreciated.
Thanks!

Any suggestion on movement would also be appreciated, as my current movement script works fine now, but I’m beginning to wonder if it’s feasible to add jumping while moving. Using AddForce also makes things slightly messy with any kind of y axis movement.