Ad
Log in to vote
0

How can i get the height of the Gerstner wave on any Coordinates?

Asked by 1 month ago
function GerstnerWave(SamplePosition,Wavelength,Direction,Steepness,Gravity,SampleTick)
    local k = (2 * math.pi) / Wavelength
    local a = Steepness/k
    local d = Direction.Unit
    local c = math.sqrt(Gravity / k)
    local f = k * d:Dot(Vector2.new(SamplePosition.X,SamplePosition.Z)) - c * SampleTick
    local cosF = math.cos(f)

    --Displacement Vectors
    local dX = (d.X * (a * cosF))
    local dY = a * math.sin(f)
    local dZ = ( d.Y * (a * cosF))
    return Vector3.new(dX,dY,dZ)
end

using the gerstner wave function to get the height is too buggy and weird. is there anyway to get an accurate Y coordinate?

Answer this question