Hi Plumbjet,
Here we go, I took the prefab from the mouse drag example and modified it to clamp the camera movement on its x axis ( the vertical axis is completely disabled, seemed logical as i did it, and better show the behavior, but can be easily enabled back).
Please find the prefab attached to this post.
Explanation:
1: drag the prefab onto your scene. delete the main camera ( the one not inside the prefab).
2: select the main camera
3: select the "clamped position" fsm
4: select the "drag camera and clamp" state
ok: first thing, after I take the dragresult from the drag fsm, I simply set to 0 the axis I don't want, in our case the z axis of the drag,so that the camera only moves on the x axis.
Now, to clamp the camera movement, I created a variable "clamp distance". This is the absolute distance form both side starting at 0 int he world coordinate. So before setting the prefab position, I clamp the "new position" vector so that it's distance ( the vector distance property) is not bigger than the "clamp distance" value.
And that's it, the rest of the prefab remains untouch.
this is one way to do it, and has some restrictions, but this gives you an idea and a starting point. If you want to have the camera anywhere in the world, you will need to do more math and vector operations. Also if you want to clamp with different values on the left and right drag, you'll need to clamp each axis individually. sams if you want to clamp the vertical drag as well.
Hopefully, you'll get the idea behind the process, and will be able to extrapolate on this. If not, provide a description and I'll try to match your needs.
Bye,
Jean