Game Project: Flying Game – Part 3 – Camera Controller and Zoom Control

May 25, 2021

Flying Game

Camera Controller


Overview

After getting the basics of the camera controller down, I wanted to explore ways to make it feel more immersive. One of the ways I’ve seen racing or other fast moving games handle this was to have a zoom that mimicked the acceleration to make that feel all the more impactful. Following this, I wanted to look into connecting the player’s speed with the amount the camera zooms in on the player.

Setting the Camera Zoom Suggested by Player Speed

Since the game has a speed boost option, I wanted the impact of the speed boost to be larger than any normal speed the player can reach. With this in mind, I was looking at an approach where normally their max speed gets the camera up to around 80% of the maximum zoom, and activating a boost is the only way to hit the 100% zoom mark (creating a significant difference in zoom specifically when boosting).

One immediate issue with this approach is that any zoom that is directly tied to player speed has a jarring jump in zoom position when the player boosts, since in a single frame it jumps from rather low zoom (because charing boost goes with slowing down) to maximum zoom. So while this was a decent initial approach, I knew I would want a smoother transition system to especially deal with this common extreme case.

The approach I thought of was that the camera zoom system would read the player’s speed and suggest a position for the camera to move to. If that new position is substantially far away from the current position, it would only move a portion of the way there instead of directly there. This would help me spread out extremely large zoom changes over several frames, similar to how a Lerp function may handle this.

This ended up working rather well, and can be seen in action in the video I have linked. Another hopeful benefit of this system was that I was hoping I could remove the small zoom jitter when the player’s speed is not changing any appreciable amount. This is an effect that happens often when the player is consistently maintaing the normal top speed. I was hoping to use the opposite distance check of not changing the zoom at all at very small distance changes, but as can be seen in the video as well this does not particularly fix it currently.

Camera Controller – Zoom Focus from Steve Lilley on Vimeo.

Video: Zoom Based on Speed System for Camera Controller

via Blogger http://stevelilleyschool.blogspot.com/2021/05/game-project-flying-game-part-3-camera.html