Promoting clamp until function, as it may be useful outside of the game engine