[DEV] Camera Improvements 📸

This week I focused mainly on improving the camera. First, I added three options for the camera’s position, which can be cycled through while playing.


Two new camera views – overhead (left), and reverse (right)

I also spent quite a bit of time trying to figure out how to prevent the player from going off the edge of the screen. Our first pass at the camera script set it to look directly at the player, but when racing quickly, this felt like running while staring at your shoes. So instead, I made the camera look at a point slightly down the track from the player. The problem with that solution was that if the look ahead value was too big, on sharp corners the player would go off the edge of the screen.

To solve this, I retrieved the player’s position in screen space to determine how close to the center of the screen they are. Then I used this value to interpolate between looking at the point down the track, and looking at the player.

The following image represents the player’s “off-centerness”, white being nearly off-screen, and black being fully centered. The higher this value (closer to white), the more the camera takes the player’s position into account.


That’s it for this week.

-Andrew Weeks


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s