Heres the script so you can help me apply changes to it.
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, Vector3.new(0, -char.Humanoid.HipHeight - 2, 0), 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)
This topic is gonna be reposted because not alot of people are helping me and I can’t figure this out I am not gonna be using Gravity Controller so don’t send me links of the module please.
I want to finish my game so others can have fun in it and have more experience in the game.
The issue is that I can’t run around the whole sphere without falling, and I forgot to mention this but when the character slows down while under the sphere he just falls off.
A solution I have tried is searching it up on YouTube and I found the tilt system How to Make a Slope Tilting System | Roblox Studio [R15] - YouTube and I couldn’t find any other results that had something to do with falling off when slowing down and going around a entire part.
Video or Step - By - Step will be nice for me to understand it and memorize it more. Thank you all for viewing this topic.
You’re correctly controlling the orientation of the character, but you’re doing nothing about the gravity. It’s not clear from the Sonic video you linked how you want gravity and/or sticking to surfaces to work in your game, so you’ll have to decide on that before you can go any further.
I believe @ThanksRoBama is saying you’ll need to handle the force that actually keeps the character on the surface they’re walking on. The gravity, which is the downforce. This is usually exerted relative to World positioning meaning down is always down and up is always up. But when you’re handling gravity in such a way you’re looking to do, then up should always be relative to the character.
So the downforce should always be exerted in the direction to the surface below the character. For planetary physics, Gravity is a downforce in the direction of the center of the planet. Unfortunately, I’m not familiar with these methods as I haven’t tried making any functionality similar to this.
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.
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)
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.