Hello. Maybe I did not quite understand the question, but still, maybe someone will answer.

I am writing a game RTS. View from above.

In general, what is the problem. I wrote a script to increase the view of the camera (review). Camera: Ortographic. Also in this script added lines to move (scroll) the camera. Put a limit using Mathf.Clamp. Now what a bug: When I do not increase the camera view (Zoom in), the restrictions work fine, the camera does not go beyond. But when I increase the orthographicSize , the camera cannot reach the end of the scene, and it turns out that the limitation has increased.

And how can you make the limitation of the camera view increase relative to orthographicSize ?

Game made by android. Here is the code for scrolling the camera:

var pos = Camera.main.transform.position; pos.x = Mathf.Clamp (Camera.main.transform.position.x - Input.GetTouch (0).deltaPosition.x * 0.15f, 6.0f, 30.0f); pos.z = Mathf.Clamp (Camera.main.transform.position.z - Input.GetTouch (0).deltaPosition.y * 0.15f, -300.0f, 15.0f); Camera.main.transform.position = pos; 

Probably, I could not normally explain, if anything, I'm sorry. Thanks in advance!

  • What is your topic reminds answers.unity.com/questions/433665/… Do you need it? - test123
  • Thanks, but I already solved the problem. Made it so that the boundaries increase with increasing camera. The topic is closed. - General2001

0