What is the best way to zoom a map with an orthographic camera?

This is similar to my previous question in that the game environment is the same: I’m making a 2D board game, the game board is situated such that The Main (orthographic) Camera looks down in the Y axis to see the face of the board. So looking at the board the x axis is left/right (west/east) and the z axis is top/bottom (north/south). The y axis is not used except to initially set the height (distance) of the camera from the board and should never be changed.

The game board is like a large map in that it is bigger than the orthographic camera’s size so in order to see the whole map I have to either change the size of the orthographic camera OR scale the board (‘GameBoardObj’ in the example below).

What is the best way to implement this? (I’m using pinch gestures to zoom in/out of the map.)

  1. Adjusting the camera’s view via Camera.orthographicSize
  2. Adjusting the map’s scale via GameBoardObj.transform.localScale
  3. Other

I’d be using the orthographicSize - I wouldn’t mess with your game objects scale (because it can cause problems with collision detection etc if things have colliders and don’t have rigidbodies).

This is what we use for one of our game to Zoom in and out:

if(GUI.RepeatButton (plusButton,"+")){
   if(camera.orthographicSize>= minPos)
      camera.orthographicSize -= Time.deltaTime * speedZoom;
}
if(GUI.RepeatButton (minusButton,"-")){
   if(camera.orthographicSize <= maxPos)
      camera.orthographicSize += Time.deltaTime * speedZoom;
}

(plusButton and minusButton are the Rect)