Camera Zoom limit

Hi how do I have a limit to zoom in the camera using pinch gesture. Because right now I can zoom in the game infinitely. How do you add a limit for zoom? Thanks

I set up a scene variable set to the camera zoom. Then I have a condition for min zoom i want and another one for max zoom I want. Like var zoom greater than 3 set camera zoom to 3 var zoom less than .5 set zoom to .5 But come to think of it you can probably just say camera zoom is past a certain number you want, set camera zoomed to number you want.

2 Likes

But how do you connect the variable to the camera zoom

Hello @Destructo ,
you can add a simple condition to zoom event.
If you have a lot of point where you manage the zoom you have two resolution:

  • create an extension to manage it and call it every time you need (I prefere this way)
  • put a conditon on the bottom of main code: if zoom is out of range, modify it .

Regards,
J

This probably solved it, but I can add an image when I get home.

Yes please send image thanks

Ok you’ll see a button that looks like sigma 123 and if you enter it you can type cam and pull up CameraZoom(layer,camera)

So here I’m not using a variable but just using “compare 2 numbers” condition (but you can use a variable too, just while I messaged you I realized I could do it without a variable)

I think the way J does it is probably better but I don’t know how to create an extension so I can’t help there.

1 Like

Ok thanks for the image

This should also work

3 Likes

Thanks a lot, I love it!

1 Like