camera boundries

making 2d game. Got my multi-object map working. The map is dynamic using multiple large meshs to simulate 100 of hexes.

Anyways having issues setting the boundaries of the camera limit. Its pixel perfect but the y axis isn’t working. I can’t get the adjustment right.

Is there a way to see if the camera is off object? I know for one object there is. But my wargame map is huge. So there are multiple objects representing each 100x100 section of the 500x500 map.

Or any other alternative ideas.

I thought maybe using raycast for the camera might be a good idea?

whyyyyy (< Only ever 91 hexes, even if you go forever, 2000 tris (1.8 with overlay off), height is sampled from perlin so it’s always the same - could easily get info from an array for tile types instead (wanted a quick demo))
To limit camera movement, just clamp it’s position values to within a few units of the maximum and minimum sizes (So if theres 100 tiles from 0 to 100 along the x axis, camera x should be clamped between 3 and 97)

That’s how I have it now. and everything is working except the Y top axis. So I was looking for any alternative ways to do it.

I made it pixel perfect to world coordinates. Very strange. the hexes are 90x76. Each world coordinate is 1 pixel.

so lets say a 100x 100 map. The weird thing is if I put the max Y coordinate @ map dimension * tile height (100 x 76 = 760) it doesn’t work. Its weird. Sometimes it doesn’t cover the top of the map if the map is large and if the map is small it floats over the top. It should be pretty cut and clear.

Raycast is working ok. I might go back to coordinates. Something is off. I just gotta figure it out.