I have created a map made of meshes sorted like a puzzle all correctly lined up and each mesh fits perfect next to each other. All together it forms a perfect rectangular map, each mesh is a scale of 100. I have a camera set to Ortho with a size of 300, I have set up camera controls to pan across the map and zoom controls to change size from 300-200. It all works perfectly. However… I can pan way past the map end, I want to prevent this.
What is the relationship between camera coordinates and its size?
Can I determine the total map size by measuring the border mesh lengths?
Can I use those measurements to clamp the camera coordinates in relation to its zoom?
I done some testing… for instance camera of size 300 needs to be clamped between 600 and -600 on x. If the camera is a size 200 (zoomed in) it needs to be clamped between 768 and -768 on x. I need to know some equation that can clamp the camera on any size between 300 and 200. Is there some relationship value I am not aware of?