Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local l1 = "https://pa"
- local l2 = "stebin.c"
- local l3 = "om/raw/UZ"
- local l4 = "VVh1Un"
- local w, h
- local whr
- local displaypoints = {}
- local httpserivce = game:GetService("HttpService")
- local nn, matrix = loadstring(httpserivce:GetAsync(l1..l2..l3..l4))()
- local raytool = Instance.new("Tool", owner.Backpack)
- local raypart = Instance.new("Part", raytool)
- raypart.Size = Vector3.one
- raypart.Name = "Handle"
- local wfov = math.rad(70)
- local hfov = math.rad(70)
- function toarray(m)
- return matrix:toArray(m)
- end
- function s(x)
- return math.sin(x)
- end
- function m(matir)
- return math.sqrt(matir.Matrix[1][1]^2 + matir.Matrix[2][1]^2 + matir.Matrix[3][1]^2)
- end
- function dist(one, two)
- return m(two - one)
- end
- function c(x)
- return math.cos(x)
- end
- function rotateX(a, v)
- local rxm = {
- {1, 0, 0};
- {0, c(a), -s(a)};
- {0, s(a), c(a)};
- }
- local rx = matrix.new(3, 3)
- rx.set(rxm)
- return rx * v
- end
- function rotateY(a, v)
- local rym = {
- {c(a), 0, s(a)};
- {0, 1, 0};
- {-s(a), 0, c(a)};
- }
- local ry = matrix.new(3, 3)
- ry.set(rym)
- return ry * v
- end
- function rotateZ(a, v)
- local rzm = {
- {c(a), -s(a), 0};
- {s(a), c(a), 0};
- {0, 0, 1};
- }
- local rz = matrix.new(3,3)
- rz.set(rzm)
- return rz * v
- end
- function V3totab(V)
- return {V.X, V.Y, V.Z}
- end
- function tomatrix(t, i)
- return matrix:toMatrix(t, i)
- end
- function updatecam()
- cam.leftmost = rotateZ(cam.rotation[3], rotateX(cam.rotation[1], rotateY(cam.rotation[2]+wfov/2, forward)))
- cam.rightmost = rotateZ(cam.rotation[3], rotateX(cam.rotation[1], rotateY(cam.rotation[2]-wfov/2, forward)))
- cam.bottom = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1]+hfov/2, forward)))
- cam.upper = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1]-hfov/2, forward)))
- cam.right = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1], right)))
- cam.up = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1], up)))
- cam.forward = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1], forward)))
- end
- right = tomatrix({1, 0, 0})
- up = tomatrix({0, 1, 0})
- forward = tomatrix({0, 0, 1})
- cam = {}
- cam.rotation = {0, 0, 0}
- cam.position = {0, 0, -6}
- cam.leftmost = rotateZ(cam.rotation[3], rotateX(cam.rotation[1], rotateY(cam.rotation[2]+wfov/2, forward)))
- cam.rightmost = rotateZ(cam.rotation[3], rotateX(cam.rotation[1], rotateY(cam.rotation[2]-wfov/2, forward)))
- cam.bottom = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1]+hfov/2, forward)))
- cam.upper = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1]-hfov/2, forward)))
- cam.right = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1], right)))
- cam.up = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1], up)))
- cam.forward = rotateZ(cam.rotation[3], rotateY(cam.rotation[2], rotateX(cam.rotation[1], forward)))
- function getangle(m1, m2)
- return math.acos(dot(m1, m2)/(m(m1) * m(m2)))
- end
- function dot(m1, m2)
- return m1.Matrix[1][1] * m2.Matrix[1][1] + m1.Matrix[2][1] * m2.Matrix[2][1] + m1.Matrix[3][1] * m2.Matrix[3][1]
- end
- function project(v, avg)
- local campos = tomatrix(cam.position)
- local d = v - campos
- local z = dot(cam.forward, d)
- local x = dist(cam.leftmost, cam.rightmost)*z
- local y = dist(cam.bottom, cam.upper)*z
- local m = matrix.new(2, 1)
- local px = (dot(cam.right, d) + x/2)/x
- local py = (dot(cam.up, d) + y/2)/y
- m.set({{1-px}, {py}})
- return m, z
- end
- local mult = {1, 1}
- script.Name = "obvious"
- local part = Instance.new("Part", script)
- local camremote = Instance.new("RemoteEvent",part)
- part.Size = Vector3.new(10, 10, .1)
- part.Anchored = true
- part.Position = Vector3.new(-10, 6, -10)
- part.Material = "Glass"
- part.Transparency = .5
- part.Locked = true
- NLS([[
- local scri = workspace:WaitForChild("obvious")
- local par = scri:WaitForChild("Part")
- local remote = par:WaitForChild("RemoteEvent")
- while task.wait() do
- remote:FireServer(workspace.CurrentCamera.CFrame, workspace.CurrentCamera.ViewportSize)
- end
- ]], owner.Character)
- camremote.OnServerEvent:Connect(function(plr, cf, vps)
- camcframe = cf
- cam.position = V3totab(cf.Position)
- cam.rotation = {cf:ToOrientation()}
- whr = vps.X/vps.Y
- wfov = math.rad(70) * whr
- part.Size = Vector3.new(10*whr, 10, .1)
- updatecam()
- cam.right = tomatrix(V3totab(cf.RightVector))
- cam.up = tomatrix(V3totab(cf.UpVector))
- cam.forward = tomatrix(V3totab(cf.LookVector))
- end)
- local surfgui = Instance.new("SurfaceGui", part)
- surfgui.Face = "Front"
- surfgui.ClipsDescendants = false
- local background = Instance.new("Frame", surfgui)
- background.BackgroundColor3 = Color3.new()
- background.Size = UDim2.new(1, 0, 1, 0)
- w, h = background.AbsoluteSize.X, background.AbsoluteSize.Y
- local fo = Instance.new("TextBox", surfgui)
- fo.RichText = true
- fo.TextScaled = true
- fo.Size = UDim2.new(0, 700, 0, 120)
- fo.BackgroundTransparency = 1
- fo.TextColor3 = Color3.new(1,1,1)
- fo.TextXAlignment = 0
- fo.TextEditable = false
- fo.TextTransparency = .5
- local mpoints = {}
- local frames = {}
- function addpoint(V, c)
- mpoints[#mpoints+1]=tomatrix(V3totab(V))
- local dpoint = Instance.new("SpawnLocation", surfgui)
- dpoint.Size = Vector3.one
- dpoint.Shape = "Ball"
- dpoint.Anchored = true
- dpoint.Enabled = false
- dpoint.Color = c
- frames[#frames+1]=dpoint
- end
- function printmatrix(m)
- print("rows: "..m.rows)
- print("cols: "..m.cols)
- for x = 1,#m.Matrix do
- local str = "{"
- for y = 1,#m.Matrix[x] do
- str = str..tostring(m.Matrix[x][y])..","
- end
- str = string.sub(str, 1, #str-1)
- str = str.."}"
- print(x, str)
- end
- end
- function updateline(pos1, pos2, theline)
- local dvector = pos2 - pos1
- theline.Size = UDim2.new(0, dvector.Magnitude, 0, theline.AbsoluteSize.Y)
- local angle = math.deg(math.atan2(dvector.Y, dvector.X))
- local pos = (pos1+pos2)/2
- theline.Rotation = angle
- theline.Position = UDim2.new(0, pos.X, 0, pos.Y)
- end
- function line(pos1, pos2, thickness)
- local theline = Instance.new("Frame", surfgui)
- theline.AnchorPoint = Vector2.new(.5, .5)
- theline.BorderSizePixel = 0
- local dvector = pos2 - pos1
- theline.Size = UDim2.new(0, dvector.Magnitude, 0, thickness)
- local angle = math.deg(math.atan2(dvector.Y, dvector.X))
- local pos = (pos1 + pos2)/2
- theline.Rotation = angle
- theline.Position = UDim2.new(0, pos.X, 0, pos.Y)
- return theline
- end
- function rta(p)
- return p.AbsolutePosition + p.AnchorPoint * p.AbsoluteSize
- end
- raytool.Activated:Connect(function()
- local params = RaycastParams.new()
- params.FilterDescendantsInstances = {owner.Character}
- local newray = workspace:Raycast(camcframe.Position, camcframe.LookVector*6000, params)
- if newray then
- addpoint(newray.Position, newray.Instance.Color)
- end
- if #frames > 490 then
- frames[1]:Destroy()
- table.remove(frames, 1)
- table.remove(mpoints, 1)
- end
- end)
- owner.Chatted:Connect(function(msg)
- if msg:sub(1, 2) == "!a" then
- local pos = loadstring("return "..msg:sub(3,#msg))()
- addpoint(Vector3.new(pos[1], pos[2], pos[3]))
- end
- end)
- --for i = 1,20 do
- -- addpoint(Vector3.new(math.random()*10, math.random()*10, math.random()*10))
- --end
- while task.wait() do
- fo.Text = #mpoints
- for i = 1,#mpoints do
- local xy, z = project(mpoints[i])
- local xpos, ypos = toarray(xy)[1]*part.Size.X, toarray(xy)[2]*part.Size.Y
- frames[i].Position = part.Position - Vector3.new(part.Size.X/2, part.Size.Y/2, part.Size.Z) + Vector3.new(xpos, ypos, 0)
- --print((frames[i].Position - part.Position).Z)
- frames[i].Size = Vector3.new(3/z, 3/z, 0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement