🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Clamp - Is there a quick way to reset it?

Started by
3 comments, last by Ajay47 4 years, 2 months ago

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

None

Advertisement

Do you mean the math related clamp()?

If so, no there is no way to unclamp something

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