new collision test

Run Settings
LanguageLua
Language Version
Run Command
local chr = owner.Character local hum = chr:FindFirstChildWhichIsA("Humanoid") chr.Parent = game:GetService("ReplicatedStorage") script.Name = "fakeChrModel" .. owner.Name local raycastParams = RaycastParams.new() raycastParams.FilterType = Enum.RaycastFilterType.Exclude raycastParams.IgnoreWater = true raycastParams.RespectCanCollide = true raycastParams.FilterDescendantsInstances = {script} local function createPart(n, s, m, c, t, p) local limb = Instance.new("Part") limb.Name = n limb.Size = s limb.Material = m limb.Color = c limb.Transparency = t limb.Parent = p limb.CanCollide = false limb.CanQuery = false limb.Anchored = true limb.Locked = true return limb end local previousCF = chr.HumanoidRootPart.Position local function createChr() local fakeChr = Instance.new("Model") fakeChr.Name = "fakeChr" .. owner.Name fakeChr.Parent = script root = createPart("r", Vector3.new(2, 2, 1), Enum.Material.DiamondPlate, Color3.new(), 0, fakeChr) root.Position = previousCF cam = createPart("c", Vector3.new(1, 1, 1), Enum.Material.DiamondPlate, Color3.new(), 1, script) end createChr() local vel = Vector3.new() local floor local gravity = 196.2 local iterations = 0 local maxIterations = 5 game:GetService("RunService").PostSimulation:Connect(function(dt) dt *= 60 if script then if hum.Jump and floor then vel += Vector3.new(0, 0.3, 0) end local dy = Vector3.yAxis * dt * ((-gravity / 2) * dt - gravity * vel.Y) if hum.MoveDirection.Magnitude > 0 then root.CFrame = CFrame.lookAlong(root.Position, hum.MoveDirection) vel = vel:Lerp(Vector3.new(hum.MoveDirection.X, vel.Y, hum.MoveDirection.Z), 0.3) else vel = vel:Lerp(Vector3.new(0, vel.Y, 0), 0.3) end local rootDest = root.CFrame.Position + vel for i = -1, 1 do local rayFwd = workspace:Blockcast(root.CFrame, root.Size, (root.CFrame.LookVector / 2) * i, raycastParams) if rayFwd then local norm = rayFwd.Normal rootDest -= rootDest:Dot(norm) * norm end end for i = -1, 1, 2 do local raySide = workspace:Blockcast(root.CFrame, Vector3.new(1, 2, 1), root.CFrame.RightVector.Unit * i, params) if raySide then local pos, norm, dist = raySide.Position, raySide.Normal, raySide.Distance rootDest -= rootDest:Dot(norm) * norm end end local rayBottom = workspace:Blockcast(root.CFrame, root.Size, -Vector3.yAxis * 2 + dy, raycastParams) if rayBottom then local hit, pos = rayBottom.Instance, rayBottom.Position vel = Vector3.new(vel.X, 0, vel.Z) floor = true rootDest = Vector3.new(rootDest.X, pos.Y + 3, rootDest.Z) if hit.Velocity.Magnitude > 0 then root.Position += hit.Velocity / 60 end else floor = false rootDest += dy end local rayTop = workspace:Blockcast(root.CFrame, root.Size, root.CFrame.UpVector * 1.5, raycastParams) if rayTop then vel = Vector3.new(vel.X, 0, vel.Z) end root.CFrame = root.CFrame:Lerp(CFrame.new(rootDest), 0.3) cam.CFrame = root.CFrame * CFrame.new(0, 1.5, 0) end end) local remote = Instance.new("RemoteEvent") remote.Name = "KeybindConnection" remote.Parent = owner.PlayerGui NLS([[local s = workspace:FindFirstChild("fakeChrModel" .. owner.Name) local fc = workspace:FindFirstChild("fakeChr" .. owner.Name) local remote = script.Parent:WaitForChild("KeybindConnection") workspace.CurrentCamera.CameraSubject = s:WaitForChild("c") s.DescendantAdded:Connect(function(ch) if ch.Name == "c" then workspace.CurrentCamera.CameraSubject = ch end end)]], owner.PlayerGui)
Editor Settings
Theme
Key bindings
Full width
Lines