How to specify a maximum value a float variable can have?

Hi there,

How to specify a maximum value a float variable can have? In my case i don’t want a specific variable’s value to go above 1. No matter how many times it is incremented.

There’s no way to force a variable to never go above a certain value. You can use a wrapper function when setting it to limit its value, but something can always bypass it. Basically, you need to set your code up to limit its value manually, using clamp or min or some such.

Have you tried the Clamp node? I think that’s what you’re looking for.

1 Like

Thank you for your answer)