I have next setup:
-GameObject
– Camera
I have a script attached to this GameObject.
And I have this code, that I use to move Camera.
var vertical = -_touchDelta.y * Time.deltaTime;
_cameraTransform.position += _cameraTransform.forward * vertical;
Basically, I move Camera using its transform.forward (because camera is rotated). So object moves along Y and Z axis. It’s a zoom feature for my camera.
Now, how can I limit this movement to min/max?