   Positioning the camera for multiple actors
  How, like in the case of a combat camera, should you position the camera so a full view of each actor (the player and multiple opponents) is framed in the scene nicely?I know trig is involved, and it works fine for the player and one opponent (because it's simply a trianglar relationship between the player, opponent, camera), but multiple opponents has me stumped.Insight?Thanks,e[edited by - darkhaven on February 3, 2004 8:23:02 PM]
  I''m not sure but I think many opponents would be the same as two opponents, except you only consider the two actors that are farthest apart (after projection from 3d to 2d, assuming you''re doing 3D).   ;  Could try this, might be what you''re after. ;  to have simple algo, calculate the sphere around all the opponents, and try to fit the sphere into the camera. by using the sphere cenrte position, direct your camera to it. with the sphere radius, either add a zoom factor to change the FOV, or pull back the camera so the sphere is inside the FOV. Or a bit of both. It involves simple trig. It really depends how your opponents are placed. And it won;t be perfect, for sure, but it;s a start.  ;  EvilProgrammer: thanks, I''ve checked that article over thoroughly, but it more for cinematic shots (like cut scenes), and it''s limited to 1-2 actors.But i''ll try the sphere algo, sounds like a good idea.Thanks,e ;  The first thing you have to realize here is that you''re dealing with a problem that is virtually unsolvable   (from an aesthetic point of view, not mathematic)... The stick that always gets jammed in the spokes is intermediate bounding -- i.e. the camera happily figures out where it wants to go, but it can''t get there because there''s a big fat cliff in the way, and the nearest "best" spot may be nowhere near where the camera first wants to go... AND the kicker, there may not even be a best spot without radiacally changing the orientation of the camera.The only games that don''t suffer this are the fighting games like virtua fighter, where the camera just keeps itself perpendicular to the two combatants and zooms in or out depending on how far away they are from each other, and the arena is specifically designed so that no bounding will interfere with the camera.I don''t know the context of your game, so I can''t comment on what your best option is, but know that it''s most likely not so simple as finding a frustum that contains a given sphere.  Decide whether this is a battle worth fighting or whether you need to reconsider the design decision that led to "keep 2 players and a horde of enemies in the view frustum without vigorously annoying either player." ;  Thanks ajas95:Well, our game is an action/adventure game (similar to prince of persia SOT, dead-to-right, oni, mark of kri, etc.), so it has to be addressed on some level. The previous games go from a really excellent camera (POP sands of time) to where you have to literally fight with the camera while fighting enemies (oni).It seems that most games have a bag of camera tricks and mix techniques (say resident evil style while fighting in tight indoor spaces, or POP style in open areas), so I disagree, it''s definitely solvable... and I think it''s the mark of a good game.But it''s far from easy.You''re right about the fitting frustum-to-sphere, it works, but a bit too well, that is, mathematically it''s correct but aesthetically, it''s bad.Back to square one, thanks for the comments tho, it''s a start.e ;  the camera code in 3rd person games is always a very sticky part, as far as I''m concerned, especially if you want the camera to be controled by the game and sometimes also by the player. both can conflict. It''s gonna need some clever and well though out system. POP''s camera system if far far from perfect. I hate the way it gets stuck against walls, time and time again. There is not a perfect system yet. I played Mario Sunshine, and other third person games, and always had to fight with the camera system. I''m not a 3rd person specialist though, but it''s so bloody frustrating. I think the best I''ve seen so far is in Freedom Fighters. But for a beat''em up, when you have to have a more cinematic effect and target surrounding enemies, you''ll need a "director", with some clever A.I. 