How can I add a full rotation around rounded parts combined with a tilt system

Greetings, so I have figured out on how to tilt myself when walking on certain parts that go different ways and I have a bit of a problem… So this is the video of myself tilting on the sphere Screen capture - e717274178e3fc3d4abac12d0f122152 - Gyazo and as you can see when I try to walk under it I fall off and take a look at this Screen capture - 74e7d7deaf15d0eb01bf6ea2b6acc89a - Gyazo you see this person just goes around the entire sphere and I fall off…

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.

  1. I want to finish my game so others can have fun in it and have more experience in the game.
  2. 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.
  3. 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.

Have a great day!

2 Likes

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.

1 Like

Ok I understand so it has nothing to do with gravity at all.

1 Like

Im a little confused on what your saying to me here.

like decide on what exactly?

1 Like

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.

2 Likes

Could you give me the script and tell me where I need to put in in roblox studio?

1 Like

like does it belong in startercharacter?

1 Like

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?

1 Like

Wait why can’t i get the scripts is it against the rule?

1 Like

I appreciate this but its not gonna help me, it isn’t similar to what I am looking for.

1 Like

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

1 Like

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!

2 Likes

It does I will try it later and report back.

1 Like

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.

1 Like

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)
1 Like

oh I see what I did hold on, let me go fix it.

1 Like

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.