Help with creating artificial gravity relative to a ships floor

Hi folks! I was recently promoted to member so this is my first post (disclaimer this may not be a great post).

Right now I am trying to create a spaceship game where you can be in space and go in and out of your spaceship. When you are in your space ship I want to create artificial gravity that allows the player to stick to the ships floor no matter what maneuvers are done (Ex. when the ship goes upside down instead of the players falling onto the ceiling they stay on the floor and are able to walk around and jump still). Is this even possible? If so how might I go about doing it? I have searched the dev hub for a while and couldn’t find anything helpful. Thanks in advance! - Qbizh

I haven’t used it personally, but @EgoMoose has exactly what you’re looking for: Wall stick/Gravity Controller

Ok I will check it out thanks again!

One question, how might I use this module so the player can only stick to the floor?

The game linked at the bottom of that post is open source, so you can play around with it there.

The code you need to modify is the GetGravityUp function (in the example, it’s being set in the LocalScript in StarterCharacterScripts. In your case, you should set it so that the current “floor” determines the gravity vector, which might look something like this:

function GetGravityUp(self, oldGravityUp)
    return FLOORPART.CFrame.UpVector
end
1 Like

Ok thank you I will play around with it and see what works

how can I disable this module so seats will work?