Im trying to create ocean/wave system.
I dont quite understand the formula behind it and how to implement it. Currently it looks like this: https://gyazo.com/a8d970cc069e59e16f61d33e6cf35c39
local function getWaveHeight(x, y, length, steepness, vertex)
local time = script:GetAttribute("Time")
local waveLength = (2 * math.pi) / length
local amplitude = 1 / waveLength
local direction = Vector2.new(x, y).Unit
local c = math.sqrt(waveLength)
local f = waveLength * direction:Dot(Vector2.new(vertex.X, vertex.Y)) - c * time
local x1 = direction.X * (amplitude * math.cos(f)) * 10
local y1 = amplitude * math.sin(direction.y)
local z1 = direction.X * (amplitude * math.cos(f)) * 10
local result = Vector3.new(x1, y1, z1)
return result
end
Help would be much appreciated!