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 displaypoints = {}
- local httpserivce = game:GetService("HttpService")
- local nn, matrix = loadstring(httpserivce:GetAsync(l1..l2..l3..l4))()
- 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
- local points = {
- {-1, 1, -1},
- {-1, -1, -1},
- {1, 1, -1},
- {1, -1, -1},
- {0, 09890, 0},
- {-1, 1, 1},
- {-1, -1, 1},
- {1, 1, 1},
- {1, -1, 1}
- }
- wfov = math.rad(90)
- hfov = math.rad(90)
- local right = tomatrix({1, 0, 0})
- local up = tomatrix({0, 1, 0})
- local 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 t = dist(campos, v)
- 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({{px}, {1-py}})
- return m, z
- end
- local mult = {1, 1}
- local offset = tomatrix({0, 0, 0})
- fps = 61
- zfar=1000
- znear=.1
- script.Name = "obvious"
- local part = Instance.new("Part", script)
- part.Size = Vector3.new(10, 10, .1)
- part.Anchored = true
- part.Position = Vector3.new(0, 6, 0)
- part.Material = "Glass"
- part.Transparency = .5
- part.Locked = true
- local surfgui = Instance.new("SurfaceGui", part)
- surfgui.Face = "Front"
- surfgui.ClipsDescendants = true
- 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 f = Instance.new("TextBox", surfgui)
- f.Text = "fps: "..fps
- f.TextScaled = true
- f.Size = UDim2.new(0, 300, 0, 60)
- f.BackgroundTransparency = 1
- f.TextColor3 = Color3.new(1,1,1)
- f.TextXAlignment = 0
- f.TextTransparency = .5
- local fo = Instance.new("TextBox", surfgui)
- fo.RichText = true
- fo.Text = "wfov (degrees): "..math.deg(wfov).."<br />".."hfov (degrees): "..math.deg(hfov).."<br />".."pos: "..cam.position[1]..", "..cam.position[2]..", "..cam.position[3].."<br />".."rot: "..cam.rotation[1]..", "..cam.rotation[2]..", "..cam.rotation[3]
- fo.TextScaled = true
- fo.Size = UDim2.new(0, 700, 0, 120)
- fo.Position = UDim2.new(0, 0, 0, 60)
- fo.BackgroundTransparency = 1
- fo.TextColor3 = Color3.new(1,1,1)
- fo.TextXAlignment = 0
- fo.TextTransparency = .5
- local mpoints = {}
- local projpoints = {}
- local poss = {}
- local pstatic = {}
- 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
- for i = 1,#points do
- mpoints[i] = tomatrix(points[i])
- local dpoint = Instance.new("Frame", surfgui)
- dpoint.Size = UDim2.new(0, 10, 0, 10)
- dpoint.AnchorPoint = Vector2.new(.5, .5)
- local corners = Instance.new("UICorner", dpoint)
- corners.CornerRadius = UDim.new(1,1)
- poss[i] = Vector2.new()
- displaypoints[i] = dpoint
- end
- local to12 = line(poss[1], poss[2], 1)
- local to24 = line(poss[2], poss[4], 1)
- local to43 = line(poss[4], poss[3], 1)
- local to31 = line(poss[3], poss[1], 1)
- local to67 = line(poss[6], poss[7], 1)
- local to79 = line(poss[7], poss[9], 1)
- local to98 = line(poss[9], poss[8], 1)
- local to86 = line(poss[8], poss[6], 1)
- local to61 = line(poss[6], poss[1], 1)
- local to72 = line(poss[7], poss[2], 1)
- local to83 = line(poss[8], poss[3], 1)
- local to94 = line(poss[9], poss[4], 1)
- local angle = 0
- while task.wait(1/fps) do
- --cam.position = V3totab(owner.Character.Head.Position)
- --local xrot, yrot, zrot = owner.Character.Head.CFrame:ToOrientation()
- --cam.rotation = {xrot,yrot,zrot}
- angle = angle + .02
- 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)))
- fo.Text="wfov: "..math.deg(wfov).."<br />".."hfov: "..math.deg(hfov).."<br />".."pos: "..cam.position[1]..", "..
- cam.position[2]..", "..cam.position[3].."<br />".."rot: "..math.round(math.deg(cam.rotation[1]))..", "..math.round(math.deg(cam.rotation[2]))..", "..
- math.round(math.deg(cam.rotation[3]))
- for i = 1,#displaypoints do
- local rotated = rotateX(angle, mpoints[i] + offset)
- rotated = rotateY(angle, rotated)
- rotated = rotateZ(angle, rotated)
- local proj, z = project(rotated)
- local x, y = toarray(proj)[1]*mult[1], toarray(proj)[2]*mult[2]
- projpoints[i] = {x, y}
- poss[i] = Vector2.new(x*w, y*h)
- displaypoints[i].Size = UDim2.new(0, 60/z, 0, 60/z)
- displaypoints[i].Position = UDim2.new(projpoints[i][1], 0, projpoints[i][2], 0)
- displaypoints[i].Visible = true
- end
- updateline(poss[1], poss[2], to12)
- updateline(poss[2], poss[4], to24)
- updateline(poss[4], poss[3], to43)
- updateline(poss[3], poss[1], to31)
- updateline(poss[6], poss[7], to67)
- updateline(poss[7], poss[9], to79)
- updateline(poss[9], poss[8], to98)
- updateline(poss[8], poss[6], to86)
- updateline(poss[6], poss[1], to61)
- updateline(poss[7], poss[2], to72)
- updateline(poss[8], poss[3], to83)
- updateline(poss[9], poss[4], to94)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement