Hi, this right here is supposed to make a player rotate to the angle it is walking on. For some reason, if I run at least 16 walkspeed, the player tries to climb over its own HumanoidRootPart.
How do I stop this from happening?
local root = HumanoidRootPart:WaitForChild("Root Hip"); local rootC0 = root.C0; local rootC1 = root.C1; function update() -- not as great on steep slopes b/c it wants to climb its own Humanoid Root Part with the fixed direction of the way local direction = Vector3.new(0, -4, 0) --torso.CFrame:vectorToWorldSpace(Vector3.new(0, -4, 0)); local ray = Ray.new(HumanoidRootPart.CFrame.p, direction); local hit, pos, normal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {character}); if hit then local cross = Vector3.new(0, 1, 0):Cross(normal); cross = cross.magnitude == 0 and Vector3.new(1) or cross; local angle = math.acos(normal:Dot(Vector3.new(0, 1, 0))); local lateral = HumanoidRootPart.CFrame - HumanoidRootPart.CFrame.p; local cf = CFrame.new(pos + normal * 3) * CFrame.fromAxisAngle(cross, angle) * lateral; root.C0 = HumanoidRootPart.CFrame:inverse() * (cf * rootC1); else root.C0 = rootC0; end; end; game:GetService("RunService").RenderStepped:connect(update);