- Home /
Camera Following Multiple Objects
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!
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?
Your answer
Follow this Question
Related Questions
how to make my camera follow multiple children of objects? 0 Answers
Select/Drag/Drop Objects with a mouse 0 Answers
Multiple player objects with using one camera 1 Answer
How to add Pinch to Zoom? 0 Answers
Set Max Rotation On Weapon Sway 0 Answers