Water Level Calculations broken

Attempting to calculate a “water level height” value when an object is rotated at an angle (OR NOT, IT CAN REACH 0 AND 90 DEGREES)

So far I got to the video shown, but as you can see the video shows flaws such as the water level not correctly setting when below or above a certain angle (nearing 90 and 0), here is the formula used:

WaterLevel = math.sqrt(2 * Area * math.sin(theta) * math.cos(theta))
local BottomPoint
    if script.Parent.Rotation.Z < 0 then
        BottomPoint =    getCorners(script.Parent).bottomBackRight
    else
        BottomPoint = getCorners(script.Parent).bottomBackLeft
    end

    --hieght when flat * cos(angle)



    local theta = math.rad(math.abs(script.Parent.Rotation.Z))
    local WaterHeight = 15 --percentage value



    local TotalHight = script.Parent.Size.Y

    local Percentage = (WaterHeight/100  * TotalHight)



    local Width = script.Parent.Size.X

    local OriginalArea  = Width * WaterHeight

    ---triangle = b*h/2
    -- W = SQRT:2*A * Sin(theta) * Cos(theta)
    local Area = Width * Percentage

    local WaterLevel
    local epsilon = 1e-6 -- A small offset to prevent division by zero

    
        WaterLevel = math.sqrt(2 * Area * math.sin(theta) * math.cos(theta))
    
    
    local ninedggh
        
    
    
    workspace.WaterlevelPart.Position= BottomPoint + Vector3.new(0, WaterLevel, 0)

Heres a video as an example of the issue, again you notice how the water level is going correct for a bit, and then once rotation to far to one side (either 0, or 90) then the water level starts rapidly dropping instead of returning to the flat water level:

Video with better angle: https://youtu.be/QPTD4TGKeao