Sign in to follow this  
InfestedFurby

camera viewing multiple players

Recommended Posts

InfestedFurby    122
Hi all, I'm writing a small tank battle game with mostly 2d gameplay but 3d graphics. Each player controls a tank, and the tanks move around on a 2d map which a camera views from overhead. I'm trying to find a way to have the camera move around smoothly to view all players in the map, zooming in when all players are in one area and backin off as they spread apart. It will be similar to the camera style in Smash Brothers if you have played that. So does anyone know of an article about this type of camera or its industry jargon name so I can google for it? Thanks in advance for any help, - InfestedFurby

Share this post


Link to post
Share on other sites
Qatal    127
A very easy thing to do...

Just remember your high school trigonometry...

1. Work out the bounding-box of your players.
2. Set X,Z coordinates of camera to the center of the bbox.
3. Based on your FOV (a known constant), work out how far above (Y) coordinate, you're going to need to be, in order to have the entire bbox in view.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this