Uh..now I am confused

I was understanding the if func but the clamp function totally confused me…sometimes less is more.

I know it’s not what you meant, but that’s effectively what clampf does: it lessens the range of values that a variable is allowed to have. Where Kaan’s if-statements check if the value is outside a certain range and set it back if necessary, clampf literally does exactly the same thing internally. It’s a funnel. Give it a number and a range, and it will return a new value that is within that range.

  • if number is outside the range, return the min or max of the range, depending on whether number was below or above the range respectively.
  • if number is within the range, return number unchanged.
1 Like

Privacy & Terms