Universal Gravity Controller
What I worked on
In case Roblox physics weren't difficult enough, I decided to take it to the next level by making a realistic mass-based gravity controller, which I'm calling the "Universal Gravity Controller." This system applies to both players and objects in the world, sharing the same Newtonian gravity math.
Background
I wanted to experiment with a realistic gravity system inspired by Super Mario Galaxy, one of my all-time favorite games. To my (somewhat) surprise, this game doesn't use a realistic gravity system and instead employs clever overlapping gravity fields.
I could try this too, but setting up seamless transitions and flow is a game-specific problem, not a system problem, and doesn't easily apply to any other game.
Technical Breakdown
To get this to even somewhat work, I had to give up trying to use Ego Moose's Wall Stick. A realistic gravity system can't function with Wall Stick from competing vectors, so I disabled all of Roblox's states, gravity, and player animations.
The controller constantly realigns the player with the surface and pulls them toward the object's center based on mass. This applies to other objects too so that objects stay on the surface and planets can orbit each other or collide.
The controller tricks the native engine into playing walking animations and subtracts the last frame's ground velocity to prevent the character from flying off the planets orbiting at extremely high speeds.
Up Next
This is still a bit buggy due to two core issues: 1. There might be a bit of a desync between the character's physics and the camera, causing some delays and jitter. 2. The planets are absolutely massive and moving at record speeds (like thousands of studs at a time). I'm pretty sure the native engine itself can't handle this and causes some pretty intense jitter for players. You can imagine a real "Goldilocks" scenario in these simulated solar systems, where the distance and size are just right for properly walking around the planet without crashing into another or jittering constantly.