Expression Rounding

I was working on proximity sound, but the sounds keeps clicking out when the volume had a decimal, or so I think that’s what is causing it.

So I was wanting to know if there is an equation to round the number to the nearest whole number. I think there’s like a Math.round or something, but I forgot the whole equation.

2 Likes

I think there is a rounding feature built into one of the behaviors but I’m not sure

1 Like

The equation is Math.round(a)
Math.round, however, rounds to the nearest whole number.
But you can easily get around this. Math.round(a*10)/10 rounds to the tenths. This is because you multiply the number by 10 before rounding and then divide by ten.

4 Likes

Alright, thank you.

3 Likes