Need Help on Making a Gravity System

I’m looking to make a gravity system somewhat similar to Super Mario Galaxy.
Thing is, I have no idea where to start. :huh:
I just need a basis on what and where to start on.

I got started by making a script which attracts the players root part towards another part, simulating gravity. But my main problem is making the player actually able to stand up on that part.

I’ve looked through some other systems people have made, but they are all either outdated, really complex, or just simply don’t work anymore…

Any help would be much appreciated, thank you!

in workspace there is a property called gravity, maybe adjust that to what u need

he’s thinking of smaller planets that you gravitate to and can walk around on freely

like u mean u jump and u can go towards other planets

exactly what i mean. just look at super mario galaxy footage

oh ye i saw ye idk how to do that

get direction going towards planet center relative to player and then just calculate what would be perpendicular

You mentioned looking through other people’s existing solutions before; I’m gonna link the ones I know about just in case you didn’t see either of them even if it’s unlikely, namely EgoMoose’s and EmilyBendsSpace’s implementations. I’ve only used EgoMoose’s, and it needs some fine-tuning, but it works for my use case.

IIRC the way that module works is, you can require it and then run a function to force a player’s gravity to point a certain direction. In this case, your game could constantly check which planet’s surface the player is closest to, and point their gravity towards it.

Those implementations are complex specifically because this is a pretty complex problem! Character controls and the Humanoid’s state machine, as well as camera movement all have to be precisely adapted to a new form of gravity which ROBLOX is just not typically used for. I would recommend further trying to finetune those modules unless you feel like you can tackle each of the problems that will arise when trying to make your own version, in which case I have no tips to give other than GL HF.

I actually did see EgoMoose’s gravity system, but I could never really figure out how to tinker and change it to my liking, but I managed to do so. I took a little peeksy inside some of the module scripts and had no idea what was going on, but I did manage to figure how to change from normal gravity, to planetary gravity, and to a set direction of gravity with this useful function inside of the gravity controller called GetGravityUp. :happy2:

I’ve never heard of EmilyBendsSpace’s implementation so I’ll look into that to see if it’s a better system for me to use compared to EgoMoose’s.

It would be cool for Roblox in the future to make a complete system like this as it would open up many opportunities for us developers to create some really cool stuff, but I’m sure they have way more serious problems to deal with.

Anyways, I’ll mark your reply as the solution. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.