Could you give me the script and tell me where I need to put in in roblox studio?
like does it belong in startercharacter?
We can’t exactly give you scripts on how to do it, but we can do references
https://www.roblox.com/games/23074509/Planetary-Gravity
You could try & edit this place to see how it works?
Wait why can’t i get the scripts is it against the rule?
I appreciate this but its not gonna help me, it isn’t similar to what I am looking for.
Occasionally on this category, spoonfeeding exists (Or making people write entire scripts for you)
Try not to do that if possible, also you’d need to get the Planet’s Gravity & adjust it to have its own force so that players can’t jump down from the ground easily
I can’t help much, since I don’t know how planet gravity works
This ray only ever looks downwards in the world axis, so when you’re anywhere that’s beyond the upper hemisphere your ray won’t find the sphere.
Instead consider using
-rootPart.CFrame.UpVector * (char.Humanoid.HipHeight + 2)
as a direct replacement for
Vector3.new(0, -char.Humanoid.HipHeight - 2, 0)
in your ray construction.
The UpVector is a unit vector (length of 1) that points upwards from the rootpart. By inverting it (getting the negative) and then multiplying by the distance you want to check, it will now be searching “downwards” in the local coordinate system.
So when you’re upside down, the ray will be pointing upwards in the world, when you’re on the side, it’ll be point sideways in the world.
I hope that all makes sense!
It does I will try it later and report back.
Reposting is not allowed, simply wait for a response. We are not waiting at our computer for people asking for help. It can take a couple hours for responses. We can not give you a script, but yes you must have a downwards force for the character, although Gravity Controller is already heavily optimized.
ok so I did it and it didn’t seem to work, did I make any errors?
local char = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local lowerTorso, rootPart = char:WaitForChild("LowerTorso"), char:WaitForChild("HumanoidRootPart")
local params = RaycastParams.new()
params.FilterDescendantsInstances = {char}
params.FilterType = Enum.RaycastFilterType.Blacklist
game:GetService("RunService").Heartbeat:Connect(function()
local ray = workspace:Raycast(rootPart.Position, -rootPart.CFrame.UpVector * (char.Humanoid.HipHeight + 2), params)
if ray then
local vector = rootPart.CFrame:VectorToObjectSpace(ray.Normal)
lowerTorso.Root.C0 = CFrame.new(0,-1,0,1,0,0,0,1,0,0,0,1) * CFrame.Angles(vector.z, 0, -vector.x)
end
end)
oh I see what I did hold on, let me go fix it.
yep I doubled check and still isn’t working…
I don’t fully understand what you’re trying to achieve with the lower torso part of the script in terms of why you are moving a weld on that specific part.
You’ve not given any details about how the root part is located.
I would have expected you to run on Stepped rather than Heartbeat and to be directly positioning the humanoid root part, or giving the root part a force towards the sphere that acts like it’s gravity.
If you’re able to explain a bit more or present the entire script with what the Root weld is welding the LowerTorso to, that may help. If you’re moving lower torso relative to the root part that would probably not be good.
did you take a look at the 2nd gyazo video? https://gyazo.com/74e7d7deaf15d0eb01bf6ea2b6acc89a this is what I want to achieve, I don’t really know about humanoids and rootparts because I havent been on studio for a long time.
My first gyazo video is still the problem that its being now, I have the tilting part down, I just want to around around the sphere and when I stop or slow down I fall.
Yes I understand what you want, but there will likely be multiple ways to achieve it. The humanoid can be a bit fiddly at times so it’s probably best to take a look at how EgoMoose achieved it in his wall stick module (or just use his module).
It allows you to do all sorts of crazy things, including walking on curved surfaces/spheres and terrain. Egomoose is far superior at this kind of math and has taken the time to work out all the funky things without you ragdolling or being unable to jump or all of the other issues that come with trying to set the torso or root part CFrame directly.
Added: If you can learn parts of it and understand how it works, then you can recreate a subset of its functionality if you’re against using the module.
He said he didn’t want to use that (for whatever reason, even though it is heavily modified)
The reason I don’t want to use it is because when ever a player jumps off a part they end up flying in the other direction which makes it look a bit weird.
Do you have a video of what you mean? You might be better off modifying the module to prevent that particular bit of logic.
You don’t have to directly use the module, I know you said you didn’t want to, but what I was more suggesting is to look into the code to understand how it works, and then you can apply the same techniques that are applied there.
I personally haven’t had the time to really look into it, so I couldn’t tell you off the top of my head, but I’m sure if you can identify exactly what behaviour it does that you don’t like, and can pinpoint the cause of it, myself or someone else on the forum might have some suggestions to try that might fix that without having to reinvent the wheel.
Yes I am gonna post a GIF in a bit.