How to make a custom physics system for moving reference frames

I’m trying to make a space game, where players build ships and travel between planets, and I want to allow players to move and walk on the ships and planets while the ship and planets are moving.

This causes issues with the physics system, as nearly every ship and planet would be accelerating at all times due to gravitation, which prevents players from walking, especially since gravity is hard-coded in Roblox to face in the negative Y direction.

I’ve tried creating a custom object class that can be connected to unanchored baseparts and models that applies a vectorforce that mimics universal gravity, as well as using EgoMoose’s wallstick module to keep players on planets, but that makes my code very clunky and makes it hard to manage players as the wallstick module is mostly clientside.

I’ve also tried to reverse engineer the wallstick module to work serverside and can be applied to unanchored parts as well, but that has been giving me camera issues and I’m worried about how well I can scale it up for many planets and ships requiring the system at once, as it relies on CollisionGroups, which has a maximum of 32 per place.

So that is taking me back to the drawing board here. The goal is to make a system that makes physics objects and players orient upwards with away from the nearest celestial body, stick to reference frames as they move, and ideally be recursive so a ship that acts as a reference frame for its cargo and crew can also be a physics object on a planet. Any ideas on how to implement this?