How would I make slope tilting?

How would I go about making it so that you tilt when going up slopes like loops? Like something in a sonic game? I have looked around the forums and haven’t found anything that could help me. I would want it so that you stick to the walls as you’re running and once you stop running, you fall to the ground. Sorry if this seems tedious but I’m new to scripting hehe :sweat_smile:

3 Likes

a way to do this that might be worth exploring is:

-if the character is going “fast” (whatever speed u think is fast enough to go up walls) then
while that speed is maintained run something like this

if speed = fast then
  Char.LeftFoot.Touched(connect(function(PartHit)
     if PartHit ~= the center of gravity then
       --make "PartHit" the center of gravity
     end
  end)
end

^something like this^ could work its just theoretical though and i havent actually tested it but if it works then there you go.

Ok I’ll definitely try this when I get the time to. Thank you for your help!

You may want to Search ‘Wall climbing’ in the search bar up top. A lot of people have posted numerous threads about that.
It’s pretty much the same idea and you may come across someone who has solved the ‘gravity when stopped’ issue.

This article may be what you’re looking for:

I’ve seen that before and unfortunately isn’t. The way that works is like rotational planet gravity. Ever played super Mario galaxy? That’s kind of what that is. I’m looking for more of a sonic type thingy where he goes through loops.

Yes, but you may have to take the Wall stick/Gravity Controller script as @supershamrock23 noted and modify it to your needs.
@EgoMoose does awesome work with items like this, but it was only set up for those parameters.

This is correct. You can quite easily modify the controllers in my post to behave like a sonic game instead of a mario game.

2 Likes

Alright I’ll try it thank you ego moose

1 Like

is this a local script? and does it go in startercharacter?

	local ray = workspace:Raycast(rootPart.Position, Vector3.new(0, -humanoid.HipHeight - 2, 0), params)
	if ray then
		local vector = rootPart.CFrame:VectorToObjectSpace(ray.Normal)
		
		local dot = ray.Normal:Dot(-rootPart.CFrame.LookVector)
		local angle = math.floor(math.deg(math.acos((dot / (ray.Normal.Magnitude * rootPart.CFrame.LookVector.Magnitude)))))
		--ts:Create(Torso, TweenInfo.new(0.1), {C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) * CFrame.Angles(vector.z, 0, -vector.x)}):Play()
end

some raycasting stuff should do the trick!

1 Like

Thank you so much and sorry for the late reply, I haven’t used DevForum in ages! I tried you’re script but it didn’t run, also, could you please explain how it works if it isn’t too much to ask