Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Water 3D[Roblox version] --
- Workspace.CurrentCamera:ClearAllChildren()
- local Pts = {}
- Player = game.Players.LocalPlayer
- Mouse = Player:GetMouse()
- script.Parent =nil
- --S = Instance.new("ScreenGui",Player.PlayerGui)
- function NewPoint(SC,X,Y) -- new points
- local P = {}
- P.V = 0 -- up/down velocity
- P.P = #Pts -- up/down height.
- P.LastP = P.P
- P.Part = Instance.new("Part",Workspace.CurrentCamera)
- P.Part.Anchored = true
- P.Part.BrickColor = BrickColor.new("Bright blue")
- P.Part.FormFactor = "Custom"
- P.Button = Instance.new("ClickDetector",P.Part)
- P.Part.TopSurface = "Smooth"
- P.Part.Transparency = 0.5
- P.Part.CanCollide = false
- P.Clicking = false
- P.Button.MouseClick:connect(function()
- P.Clicking = true
- On = false
- local Tip = 0
- local TipM = 800
- local T = Mouse.Hit
- local MDis = 10
- for i,v in pairs(Pts) do
- v.Hax = v.P
- end
- local N = P.P
- repeat wait()
- if Tip < TipM then
- Tip = Tip+(TipM-Tip)*0.05
- MDis = MDis +0.01
- end
- for i,v in pairs(Pts) do
- local r = (v.Part.CFrame.p-T.p).magnitude
- if r < MDis then
- v.V = 0
- v.P = v.Hax+Tip*((MDis-r)/MDis)
- end
- end
- until not P.Clicking or On
- On = true
- P.Clicking = false
- end)
- P.Button.MouseHoverLeave:connect(function()
- P.Clicking = false
- On = true
- end)
- P.Part.Touched:connect(function(v)
- P.V = P.V +(v.Velocity.magnitude/3)
- end)
- P.X = X
- P.Y = Y
- --P.Gui = Instance.new("TextButton")
- --P.Gui.Size = UDim2.new(0,20,0,20)
- --P.Gui.Parent=SC
- --P.Gui.MouseButton1Click:connect(function()P.P=P.P+100 end)
- --P.Gui.BorderSizePixel=0;P.Gui.Text=''
- table.insert(Pts,P)
- return P
- end
- SZ = 12
- BT = 2
- for x = 1,SZ do
- for y = 1,SZ do
- NewPoint(S,x,y)
- end
- end
- --[[function love.mousepressed(x,y)
- -- mouse click shet
- for i,v in pairs(Pts) do
- --v.P = math.random(0,100)
- local n = i%(SZ+1)
- local d = math.ceil(i/SZ)
- local n,d = n*40,d*40
- if x > n-29 and y > d-20 and x < n+20 and y < d+20 then
- v.P = v.P+200
- end
- --v.Gui.Position = UDim2.new(0,i*20,0,500);v.Gui.Size=UDim2.new(0,20,0,-(v.P+20))
- end
- end]]
- local Sp = 0.05 -- FPS Lock.
- C = 0 -- dis goes with above
- FPS = 0
- local N = tick()
- local k = 0
- On = true
- game:GetService("RunService").RenderStepped:connect(function()
- local S = tick()-N
- FPS = S
- C = C + S
- k = k+S
- if C > Sp then
- C = 0
- for i,v in pairs(Pts) do -- hax point lerp
- local P = v
- if On then
- local B = Pts[i-1]
- local F = Pts[i+1]
- local T = Pts[i-(SZ)]
- local B2 = Pts[i+(SZ)]
- --[\[
- if B then
- v.V = v.V +((B.P-v.P)*0.1) -- add difference between point and point in front to velocity
- end
- if F then
- v.V = v.V +((F.P-v.P)*0.1) -- add difference between point and point behind to velocity
- end
- if T then
- v.V = v.V +((T.P-v.P)*0.1) -- add difference between point and point in front to velocity
- end
- if B2 then
- v.V = v.V +((B2.P-v.P)*0.1) -- add difference between point and point behind to velocity
- end
- --]]
- --[[
- if B then
- v.P = v.P+((B.P-v.P)*0.1) -- add difference between point and point in front to velocity
- end
- if F then
- v.P = v.P +((F.P-v.P)*0.1) -- add difference between point and point behind to velocity
- end
- if T then
- v.P = v.P +((T.P-v.P)*0.1) -- add difference between point and point in front to velocity
- end
- if B2 then
- v.P = v.P +((B2.P-v.P)*0.1) -- add difference between point and point behind to velocity
- end
- --]]
- P.P = P.P+(P.P-P.LastP)
- v.V = v.V*0.89 -- slow down de velocity
- v.P = v.P +v.V -- add velocity to position
- v.P = v.P*0.89
- --v.P = math.abs(v.P)
- end
- -- draw--
- local n = i%(SZ+1)
- local r = math.ceil(i/SZ)*SZ
- local d = math.ceil(r/SZ)
- v.Part.Size = Vector3.new(BT,BT,BT)
- v.Part.CFrame = CFrame.new(v.X*BT,P.P/100+3,v.Y*BT)
- P.LastP = P.P
- local n,s = v.X,v.Y
- local d = math.sin(n+(k*5))
- local j = math.sin(s+(k*5))
- v.V = v.V+((d*math.random())+(j*math.random()))
- end
- end
- N = tick()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement