How to change the gravity direction

Im currently on mobile i tried to read the scripts from GitHub page but i couldnt understand
I dont need my walls to be sticky i just want to have the ability to change the player gravity direction to the direction the player wants

1 Like

Go To Game Settings then World, and u can customize the workspace gravity

Bro not the gravity power im talking about the direction look at the link

does this answer ur question?

you can just set gravity to 0, and use your own gravity force with the direction you want to face it, apply it to every instance every frame using RS.Stepped
change player orientation, roblox does not support player orientation for basic rigs as far as I know, so you need to create a custom player character handler too

Looks like i will die making this :skull_and_crossbones::skull_and_crossbones:

Bro i already said i read the github page code and didn’t understand anything :sob:

Look into VectorForce.

local player = game.Players.LocalPlayer

local Gravity = Vector3.new(0,-150,0)

player.CharacterAdded:Connect(function(model)

local hrp = model.HumanoidRootPart
local force = Instance.new("VectorForce",hrp)

force.ApplyAtCenterOfMass = true
force.Attachment = hrp.RootRigAttachment

force.Force = Vector3.new(0,-workspace.Gravity*hrp.AssemblyMass,0) + Gravity

end)
2 Likes

This is generally the right idea, but there are a few minor issues to fix first:

force.Attachment should be force.Attachment0
force.Force = Vector3.new(0,-workspace.Gravity*hrp.AssemblyMass,0) + Gravity will actually double the existing gravity, and then apply the -150, since workspace.Gravity is a positive 196.2 and the attachment will be +Y up by default, so -196.2 is a downward force.

The more subtle issue is that in a live game, if you make a script like this that adds physics constraints to your character on your client (the VectorForce instance), these constraints won’t replicate to the server. Things will behave normally at first, since your character replicates its position and velocity to the server for as long as you have network ownership of it, but if network ownership gets transferred for any reason, like you sit in a seat of a vehicle some other player has ownership of, you could find that your simulation behaves unexpectedly, because for the server and all other clients, your character will be simulated with standard gravity. The VectorForce component exists only on your client, and only applies when you have ownership of your avatar.

2 Likes