|
Hi guys, I've got several player-controlled objects (at least 4, perhaps more in future) on screen and a single camera. The camera needs to keep all players on screen at all times. The camera should only move a limited amount, something like the camera in Super Smash Bros., which tracks the players across a nominally 2D level, panning and zooming as necessary. I know it will require some method of centring the camera on the group, and then some function to make sure the camera is zoomed out far enough away from the group that all four (or more) of them are in view at the same time (this should be done by moving the camera, not changing the FOV). I'm not great at mathematics, so this makes my head hurt a bit. Any help would be greatly appreciated!
(comments are locked)
|

Just a thought; would it work to create a bounding box and encapsulate the player objects each frame, then adjust the camera to display that box in it's entirety?
That way I definitely have a centre point (Bounds.center), and can probably work out the correct distance using some basic trig?