Friday, May 8, 2015

User Control for Camera Direction

User Control for cameras is not a very deep subject but I have some notes. These notes are based on experience from implementation and not concrete facts.

User Control For Orbiting a Camera around a Target

Smoothing


I prefer no acceleration or weight on the camera rotation based on player input, but that is something that many designers disagree with me about. My reasoning is that I like the immediacy of control to camera direction and I care more about accuracy than soft movement. The opposing reasoning is that it feels jumpy and unpolished. Spend some time on the smoothing parameters to get a decent compromise, especially if the smoothing also applies to cameras used for precision aiming.

Tuesday, May 5, 2015

Leash Camera Example

The leash camera is simple to implement and tracks a moving camera target intuitively without much polish. It can even be implemented without resorting to euler angles or quaternions since it deals entirely with the offset between the camera and the target over time.

The camera will work as long as the target speed and the distance between the camera and the target are within reason, which is usually true in platforming games.

The idea is that as the target moves away from the camera, the camera moves straight towards (or away from) the target to maintain the desired distance. Think of this as walking a dog that is running all over the place, and the leash will be stretched straight from the dog walker to the dog. The dog walker will rotate and move far less than the dog but still keep up with it. (For this example to work you also need to assume that the leash is a straight rod and not really a leash at all.)

Leash Camera Direction tracking a target moving from left to right.

Sunday, May 3, 2015

Framing a target

I tend to update a game camera in this order:

  1. Update all possible camera targets
  2. Determine current target (“subject”)
  3. Apply change of camera mode or parameters
  4. Determine the camera facing direction
  5. Determine a camera position
  6. Collision and other post update operations.

I make exceptions to this order for cameras with restricted positioning, such as cameras aligned with splines, which is a topic for future posts. Although this site does not focus on VR there are additional order updating considerations for that too.

Placing a camera to frame a subject


Of these steps, the most basic one is probably determining the camera position. It is also more forgiving than camera rotation in terms of keeping track of distant objects on the screen. When rotating the camera a distant point will move farther on-screen than a closer point, but when translating the camera the distant point will move less than a closer point.