HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Setting Camera Bounds to Follow Units

09-16-2006, 05:37 AM#1
Astrotrain
I'm trying to make a system where you can only move your camera around the map so long as your hero stays inside your camera bounds. I've tried centering the camera bounds on a region, which is centered on the unit. But since I have to constantly reset these bounds, these are both triggered every 0.01 seconds. It works fine, but the minimap constantly flashes as -what im assuming are- the camera bounds being shifted to fit the map. Is there a way to fix this? Or even better, is there an even simpler way to accomplish the desired effect?
09-17-2006, 05:02 PM#2
The)TideHunter(
Run it every 0.7 seconds.
Also, instead of running it every 0.07 seconds no matter what, check if the location of the unit is the same as it was 0.07 seconds ago, if not dont edit them, then if the unit hasent moved, it wont need to reset bounds.
09-19-2006, 03:48 PM#3
Moss
Or, if that is the camera bounds flashing then maybe you could achieve the effect of camera bounds by hand by checking the x distance and y distance between the camera and the hero, and if either is too large use some crazy trigonometry to move the camera back to a point towards your hero that is just barely in bounds. If you used the function that smoothly moves a camera over time you could probably run this trigger just once every 0.5 seconds or so.

But if The)TideHunter('s suggestion works that would be a lot simpler.