Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my function not rounding to the nearest multiple of 90?

Asked by 4 years ago
function roundd(x, roundTo, moreinfo)
    local What = (math.floor(x/roundTo)*roundTo)
    if moreinfo ~= nil then
        if moreinfo == false then
            return
        elseif moreinfo == true then
            if (math.floor(x/roundTo)*roundTo) > 180 then
                return (math.floor(x/roundTo)*roundTo)
            else
                return ((math.floor(x/roundTo)*roundTo) * -1)
            end
        end
    end
    return (math.floor(x/roundTo)*roundTo)
end

This is my function It rounds x to the nearest multiple of roundto and there is a function for the y value of orientation that makes any number higher 180 into negative but that's not the problem the problem is that it's printing out multiples of 90 but the orientation of the walls aren't actually multiples of 90 one was 116.62

Answer this question