Rounding values in MEL

Hello,

say I have:

float $pos[3];

at the moment I’m rounding the values as follows:

(floor ($pos[0] + 0.5 )
(floor ($pos[1] + 0.5 )
(floor ($pos[2] + 0.5 )

That gives me int’s but I want say 3 decimal places and the last value rounded correctly – any tips ?

Also, what is the syntax so I dont have to type out the line three times ?

(floor ($pos[] + 0.5 ) – didn’t work like I thought it might

What are the tricks ?

Kind regards 😉

No Responses to “Rounding values in MEL”

Post a Comment