The camera system in Flip's Twisted World.
An in-game camera is the player's eyes in the game world. It's a moving frame to showcase the game’s art and capture the action; it's a guide to lead players toward objectives and warn them of danger. It's one of the most difficult systems under a 3D platformer game's hood.
Flip's camera has an additional responsibility, in that it's the hidden star of the game’s core mechanic. In very early versions of the game, twisting the world would literally rotate all of the world geometry and objects into a new orientation. Updating all the physics information when we did this quickly became too much. Now, what happens is that the camera does all the work, twisting through an arc to make it appear as though everything has spun around.
Goals of Flip’s Camera:
Goals of Flip’s Camera:
Look well ahead: without intervention, the camera should do a decent job of showing what's around and, especially, ahead of Flip.
Be smooth: the camera should move smoothly, without sudden jerks or motion sickness-inducing whirling.
Respect player input: we know the automatic system will not always make the best decision. When the player wants the camera elsewhere, the system should not lock-out or fight the player, and should persist the player's stated preference afterward.
Getting the Basics
Getting the Basics
The approach we used is based on the idea of the camera swinging freely on a weightless boom attached to Flip. This lets the camera sit anywhere in a sphere around flip, with a radius of the boom's length. Each frame, we move Flip, then snap the camera to the nearest point on this sphere. This gets us the basic following behaviour: If Flip runs off to the camera's right, the boom will naturally trail behind slightly, pulling behind Flip to show the level ahead.
While this approach keeps the camera behind Flip and looking forward, it tends on its own to let the camera sink as Flip runs away from it, so you really can't get a good view of what's ahead.
To correct this we track a "target elevation" for the camera. Anytime the player moves the camera up or down, the target elevation is updated. After the boom has swung around to follow Flip, we correct its height by nudging it toward the target elevation. Now no matter how you move Flip around, the camera will respect and maintain the vertical viewing angle you’ve set. All these adjustments are incremental, so the camera movement stays smooth.
We improve the view further by pushing the camera's focal point away from Flip, in the direction opposite the camera. This has the effect of moving Flip lower on the screen, so you can see more of what's ahead of him. We look further ahead when Flip is moving fast, and allow the camera to focus back toward Flip and his immediate surroundings when Flip comes to a rest.
Zoom the Boom
Zoom the Boom
One trick with this approach is that it's very sensitive to the length of the boom used. At first we were using the same value to track the boom length and the camera zoom. This made the camera painfully unresponsive when zoomed-out far, and irritatingly fickle when close-up.
Our solution was to track the two lengths separately. The boom would determine the camera's angle. We'd then extend a line along that angle, and place the camera somewhere on this line according to the current zoom. This allowed us to tune the boom length to have just the right balance of responsiveness and smoothness, which the camera could keep at any zoom.

Watch Out for Tha– !
Watch Out for Tha– !
It doesn't matter how well a camera's following you if it gets stuck behind a wall or tree, so managing obstacles was our next challenge. Given enough time, we may have been able to create a complex system that would detect obstructions ahead and steer the camera around them... but with just seven people and a shoestring budget that wasn't about to happen.
Our obstacle avoidance is quick and dirty: If there's something blocking the view between Flip and the camera, the camera shoots forward until it's on the other side of the obstacle. This can be a little jarring, but it ensures Flip doesn’t escape the camera's (and player's) view for more than a frame or two.
This was one case where we found that a break in smoothness was preferable for playtesters, if the upshot was a better view of the action now. To cut down on unnecessary zooming, we gathered all the things that don’t really block your view (glass, grates, grass, etc.) into their own collision group that the camera simply ignores.
Here's a Hint
Here's a Hint
The last layer in Flip's camera behaviour is camera hints. These are special, invisible objects we place in the levels, to give the camera more information about what it should be doing in this instance. This lets us keep the camera out of awkward situations, direct it to frame nice vistas or goals/hazards, and help take over camera control when the player’s likely to be too busy elsewhere. Some of our hint objects include:
Camera Tunnel: pulls the camera toward one of two directions, for narrow spaces
Camera Orbit: directs the camera to orbit around a focal point, keeping it in view
Zoom Clamp: puts a limit on the min/max zoom in an area, to show the right amount

How's it Look?
How's it Look?
Flip's camera is simple, and that makes it predictable. If we can't make a camera smart enough to always be right, it should at least be easy for the player to anticipate and tweak when necessary. It follows the run and jump gameplay smoothly, and is adaptable to input from hints and from the player. As a result, I think it’s a base we'll be looking to build upon the next time we work on a 3D platformer or action title.