Clamping negative numbers doesnt work

I’m working on a 3rd person game and following a tutorial for some things while adding my own, one of which is the ability to scroll with the mouse to zoom in and out the camera.

Everything seems to work fine so far, except when I try to clamp the zoom values, most of the times it just freezes the camera, and after some messing around I found out the code works fine, IF and only when I put the zoom values in the positive, which is zooming ahead of the character.

So I did some googling and seems to be a problem with clamping negative numbers or something, but I could only find for rotations and that kinda of stuff.
Anyways, does anyone know how to do it? Is there an alternative workaround, I’m still a noob in this stuff so take it easy on me :slight_smile:

Here’s the bit of my code, doubt it’ll help:

float scrollInput = (PlayerInputManager.instance.cameraZoomInput * zoomSpeed) * zoomDampening * Time.deltaTime;
cameraZPosition += scrollInput;
cameraZPosition = Mathf.Clamp(cameraZPosition, minZoomDistance, maxZoomDistance);