I have been able to keep the position of a camera within the bounds of two given points: center and size. And that works great! I also draw it with Gizmos.DrawWireCube. I’m able to clamp the position of the camera so that it won’t go outside of this “cube” that is made out of these two points.
My question is, how can I start doing this with more complex shapes, and take out the whole “center and size”? If I make a map for the game I am building, and I have a mesh of cubes that I combine to create a weird looking polygon, how can I keep the camera inside of this? I’m sure I wouldn’t use Clamp, since that would be very complicated. I could detect which Cube the camera is in, and only Clamp it within that cube unless they go into another one that is adjacent. But that’s complicated! Should I do this with collisions? Triggers? That would seem most easy and efficient. Here’s an image to demonstrate:
Edit The Clamp I showed in the image is wrong: I forgot to offset by the center. But the question still stands.