Advertisement

Clamp - Is there a quick way to reset it?

Started by April 02, 2020 07:42 AM
3 comments, last by Ajay47 4 years, 8 months ago

Is there something like, unclamp(), to remove clamp()? Or how can set it to toggle properly, with minimal code?

None

Do you mean the math related clamp()?

If so, no there is no way to unclamp something

Advertisement

clamp() forces an upper or lower limit by replacing a value by the boundary value if it goes outside the allowed range.

If you store the clamped value in the same place as the original unclamped value, you are destroying the original value if it was out of bounds, as @shaarigan says, you cannot undo that destruction.

If you want to know the original unclamped value afterwards, store the clamped value at a different spot than the unclamped value. However, it likely needs some careful thought what the relation between both values is exactly. It seems to me at first sight that as time goes on, the unclamped value may become mostly meaningless.

thank you

None

This topic is closed to new replies.

Advertisement