Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Pixel Camera, Part version --
- function TraceRay(P1,P2,ignore)
- local Length = (P1.p-P2.p).magnitude
- if Length < 999 then
- return Workspace:findPartOnRay(Ray.new(P1.p,(P1.p-P2.p).unit*Length,ignore))
- else
- return Workspace:findPartOnRay(Ray.new(P1.p,(P1.p-P2.p).unit*999,ignore))
- end
- end
- Fov = 50
- Pixels = 50
- SZ = 300
- Length = 999
- Smooth = false
- local UI = Instance.new("Part",script)
- UI.Anchored = true
- UI.FormFactor = "Custom"
- UI.Size = Vector3.new((SZ/20)/2,(SZ/20)/2,1)
- UI.CFrame = CFrame.new(0,(SZ/20)/2,20)
- local Screen = Instance.new("SurfaceGui",UI)
- Screen.CanvasSize = Vector2.new(SZ,SZ)
- local Load = Instance.new("TextButton",Screen)
- Load.Size = UDim2.new(0,50,0,20)
- Load.Text = "Shoot"
- Load.ZIndex = 5
- Load.Position = UDim2.new(0.5,-25,1,-25)
- function Move(Max,Amount)
- return (-math.rad(Max/2))+math.rad(Max)*Amount
- end
- function Colerp(C1,C2,A)
- return Color3.new(
- C1.r+(C2.r-C1.r)*A,
- C1.g+(C2.g-C1.g)*A,
- C1.b+(C2.b-C1.b)*A
- )
- end
- Lights = {}
- function Light(Position)
- local L = {}
- L.Range = 10
- L.Position = Position
- L.Color = Color3.new(1,1,1)
- table.insert(Lights,L)
- end
- Light(UI.CFrame.p+Vector3.new(0,0,-20))
- TakingShot = false
- function TakeShot(CF,Screen)
- if not TakingShot then
- TakingShot = true
- Lights = {}
- Light(CF*CFrame.new(0,0,20))
- wait()
- P = CF*CFrame.Angles(0,0,math.rad(90))
- for i,v in pairs(Screen:GetChildren()) do
- if v.Name == "Pixel" then v:Destroy() end
- end
- for x = 1,Pixels do
- for y = 1,Pixels do
- local Hit,Pos = TraceRay(P,P*CFrame.Angles(Move(Fov,x/Pixels),Move(Fov,y/Pixels),0)
- *CFrame.new(0,0,Length))
- local IsInSunlight,LPos = TraceRay(CFrame.new(Pos),CFrame.new(Pos+(game.Lighting:GetSunDirection()*-999)))
- local F = Instance.new("Frame",Screen)
- F.Name = "Pixel"
- F.Size = UDim2.new(0,SZ/Pixels,0,SZ/Pixels)
- F.BorderSizePixel = 0
- if Hit then
- local C = Hit.BrickColor.Color
- F.BackgroundColor3 = C
- C = Colerp(C,Color3.new(0.5,0.5,0.5),0.5)
- ypcall(function()
- if IsInSunlight then
- if Smooth then
- local Mass = 5
- local Dis = (Pos-LPos).magnitude
- if IsInSunlight:IsA("BasePart") then
- local S = (IsInSunlight.Size.X+IsInSunlight.Size.Y+IsInSunlight.Size.Z)
- Mass = S
- end
- local Fin = (Mass-Dis)/Mass
- if Dis < Mass then
- C = Colerp(C,Color3.new(0,0,0),Fin-IsInSunlight.Transparency)
- end
- else
- C = Colerp(C,Color3.new(0,0,0),0.5)
- end
- else
- --C = Colerp(C,Color3.new(0.5,0.5,0.5),0.5)
- end
- end)
- ypcall(function()
- for i,v in pairs(Lights) do
- local Dis = (Pos-v.Position).magnitude
- if Dis < v.Range then
- local IsInLight = TraceRay(CFrame.new(v.Position),CFrame.new(Pos))
- if not IsInLight then
- C = Colerp(C,v.Color,(v.Range-Dis)/v.Range)
- end
- end
- end
- end)
- F.BackgroundColor3 = C
- else
- F.BackgroundColor3 = BrickColor.new("Bright blue").Color
- end
- F.Position = UDim2.new(0,x*(SZ/Pixels),0,y*(SZ/Pixels))
- end
- end
- wait(5)
- TakingShot = false
- end
- end
- Load.MouseButton1Click:connect(function()
- print("Taking shot")
- TakeShot(Workspace.CurrentCamera.CoordinateFrame,Screen)
- end)
- --NS(game:GetService("HttpService"):GetAsync("http://pastebin.com/raw.php?i=uZGGFyij"),Workspace)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement