I’ve looked through the forums and there’s like ONE other post with my issue, and it just doesn’t work for me.
I don’t know how to do anything pertaining to gravity or physics in general since I’ve only been scripting for 3-5 months. Any help would be nice, thanks!
Are you using a custom running script? Since you’re making a Sonic game, I can only assume you’ve made a custom sprinting script, or is this with Roblox’s basic running script?
If it is a custom sprinting script, if you could provide the code, I can try to look into it further, and it’d help out alot!
No, I dont know anything about custom controllers i fear; the only thing thats custom is the acceleration and still thats only increasing and decreasing the walkspeed
My fist thought for a solution is increasing gravity when the player isn’t jumping, and when they are decreasing gravity. Though that may mot be sufficient
(in this case, mass is 488 kg (calculated around 1075.8 lbs). remember that Roblox has a different scaling feature, as called the RMU (Roblox Mass Unit))
We can take theta as 45 degrees recordedly.
Force of gravity=m * g * sin(θ), so Fg = 4889.81 * sin(45) = 488 * 9.81 * sqrt(2)/2 = roughly around 3385.11815 newtons
Reactive force = m * g * cos(θ) = same as Force of gravity so its 3385 newtons.
That way we can find more stuff, such as the pull force, friction force, which are useful for this slope incline calculation.
It is not possible for the character to just turn like that instantly. To achieve this, you need to go through CustomPhysicalProperties, and increase Friction, FrictionWeight. Then you have MaxSlopeAngles, defines at what angle can the player go on. On the picture, you can tie it to the theta (the inclined plane’s angle). You could try doing things with AlignOrientation.
This is a simpler solution and may require some editing of code, but it may be something worth looking into. You can possibly use the CollectionService to set which slopes you can have the player stick to and etc.
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local function AlignToSlope(wedge)
local RootPart = Character:FindFirstChild("HumanoidRootPart")
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
if not RootPart and not Humanoid then return end
local Attachment = Instance.new("Attachment", RootPart)
local AlignOri = Instance.new("AlignOrientation")
AlignOri.Mode = Enum.OrientationAlignmentMode.OneAttachment
AlignOri.Attachment0 = Attachment
AlignOri.MaxTorque = 10^7
AlignOri.Responsiveness = 50
AlignOri.Parent = RootPart
local Params = RaycastParams.new()
Params.FilterDescendantsInstances = {Character}
Params.FilterType = Enum.RaycastFilterType.Exclude
RunService.RenderStepped:Connect(function()
local RayOrigin = RootPart.Position
local RayDirection = Vector3.new(0, -10, 0)
local Result = workspace:Raycast(RayOrigin, RayDirection, Params)
if Result then
local SurfaceNormal = Result.Normal
local Look = RootPart.CFrame.LookVector
local TargetCFrame = CFrame.fromMatrix(RootPart.Position, Look:Cross(SurfaceNormal), SurfaceNormal)
AlignOri.CFrame = TargetCFrame
else
AlignOri.CFrame = CFrame.new(RootPart.Position)
end
end)
end
AlignToSlope(workspace.Part)
This runs on client btw, if you’re wondering.
This is just an example script I gave. It probably works or not, but it depends. You can improve it here, or take advices from @HiloTheFloof mentioned. Because this thing requires a lot of manipulation and physics knowledge. Basically what it does is it uses manipulation + raycasts to analyze how in realtime you get on any slope. It works exactly like the mass slope I mentioned, but to slow your speed down you need more friction and friction weight.
Okay so this didn’t fix the slope thing, neither did the smooth wall thing (cause i’m dumb), but it did allow for me to make a rudimentary velocity system! Thank you!!