What is the best way to create directional gravity?

So i have sort of a space station lobby deal. The station utilizes centrifugal forces to simulate gravity. In this map, i have parts strategically placed around the station that detect player contact and adjust their gravity accordingly. On spawning in, the Character gets a BodyGyro and a BodyVelocity inside the root part. These values are manipulated to the orientation of certain parts they collide with. The problem is, my methods of achieving this simply arent smooth and dont work they way i want them to. I want the player to gyro in the orientation of the gravitational part, minus the y axis, and i want the first person camera to follow the orientation of the Character’s primary part so no matter what orientation they are in, it feels like they are facing right side up. The problem with the gravity is that it yeets the player out of the map once they reach a 90 degree angle, and the problem with the camera is that moving the mouse does not move the camera in the way it should and is extremely disorienting. Both the camera and the simulated gravity are also just not smooth.

The paragraph above seems like it may be unclear, so i am including a place file for what i am trying to achieve:

NewLobby.rbxl (25.3 KB)

3 Likes

Have you tried the workspace gravity property?

2 Likes

Try grabbing the place file i posted, so you can see what i mean. Workspace’s gravity property only changes the force of gravity in the workspace, not the direction, sadly

1 Like
local force = 5
local newGravity = part.CFrame.lookVector*force
part.BodyForce.Force = newGravity

this will give the part a ‘forward’ acceleration when applied to a bodyforce Force value.

you can use any combination of these ‘Directional Vectors’

forward = lookVector
backward = -lookVector
right = rightVector
left = -rightVector
up = upVector
down = -upVector
4 Likes

It seems my explanation was unclear, and i am unsure of how to make it clearer. In that place file ^^, the system i had technically works. The problem is, it has certain problems which are game breaking. I know i have seen people work this method before, and am trying my best to replicate it. I am clearly missing something however, i guess i am wondering if anyone has done this before, and if so how i would implement this.

you would use a BodyForce object with Directional Vector values, that’s how you create ‘directional gravity’

1 Like

That is what i am doing. The problem is that it is extremely buggy

Have you tried using Ego’s gravity controller?

3 Likes

Oh this is absolutely sick. Imma have to try this, thank you

1 Like