Ability to change the players gravitational direction?

Just as the title says. I am trying to make a small game with an objective similar to Mario galaxy where you chase a bunny around a small planet with some obstacles in the way to try and catch it. I speculate that the most efficient way to tackle the gravity is by trying to direct the players gravitational direction towards the planets face normal vector closest to the player, but I cannot for the life of me figure out how to change their gravity direction properly without messing up movement or knocking the player over or etc. I’ve been trying on my own for several hours and have been going back and forth with a GPT for longer and I am at a total loss at this point. If anyone could point me in the right direction of how to do that, I would be extremely grateful. Thanks.

In my opinion, you should separate the space so that player is attracted by only one of the planets in each section.
If a shape of the planet is sphere, your method seems to be the best. Is square or others, it is better to change gravity vector to be vertical to the surface of the planet.(If you imagine SMG)

2 Likes

I’m thinking of doing a similar thing but on a smaller scale. I can share some points of direction, but haven’t tackled this yet. As a low effort and general response though..

Notes:

  • maybe look at physics gravitational equation, big G
  • Roblox’s CharacterController might have a useful property
  • there’s probably a lot on this forum if you use the advanced search feature, and use key words like gravity. Maybe a community resource
1 Like

Try checking out EgoMoose’s gravity controller. It’s really cool and I think it may apply to what you want.

Alternatively, if you don’t have to worry too much about multiplayer, you could just rotate the world around the player and always keep the player in the exact same spot.

1 Like

Hi, your second response is kind of what I’m going for at the moment, having the player constantly be directed towards the face normal that’s closest to them. My main issue is really changing the gravity direction (for instance having the player be able to walk jump fall etc. at a 90-degree angle instead of straight down), that is the part I cannot currently figure out at the moment. Can you help me out a bit about changing the gravity vector?

Hi, thanks for the response. I’ve been scrolling through the forum for a while now but haven’t come up on anything helpful yet but I will keep trying.

1 Like

So, i did actually take a look at the gravity controller and while it’s pretty cool It’s a pretty complicated setup that doesn’t read character states very well so I’m not sure if it’ll be flexible for my purposes. I thought surely there must be an easier way to do this.. Also I did explore having the planet rotate since its a single player experience but you’re going to be chasing a rabbit so unfortunately the player and other actors need to be able to interact with the planet simultaneously and rotating wont work.

This tutorial would help you. Using the same method, I suppose you can make gravity system.

I think you’re misunderstanding me. I am trying to find a way to make the player be able to move and interact with a constantly changing gravity direction as if they were constantly walking on flat land. I can make objects attracted to the planets center just fine but no matter what the player is always going to want to walk on flat horizontal land and if they’re pulled into a wall or upside down they cant move.

The problems you showed can be solved, I guess. Simply, change CFrame and moving direction in every frame.

That was my initial approach but since humanoids are basically hard locked to the y axis for locomotion and physics needs they wont be able to navigate unless they’re moving on something planar because as soon as they dip over the edge they go stiff and lose control because the game thinks they’ve fallen over i guess. Might just shelve this for now.

I played an obby using a system like SMG, so there should be a method to do it.
This topic may help you: Help disabling player falling over