[DEV] Managers, bug fixes


This week was mostly spent on fixing bugs, improving the structure o
f our code, and adding more to the managers. Some bugs were created by moving things around and being moved to the managers, which sometimes made variables not accessible.

The structure was improved by changing the way UI works, instead of 2 separate canvases as loose gameObjects (which required scripts to ask for the player number every time), they are now instantly accessible for each player without having to worry which player it is exactly.

Also more script variables were added to the managers.

[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