Devlog 5








After I had successfully established core mechanics like driving, turret operation, and firing, I shifted my focus to refining the player experience using camera systems. The second important feature was ensuring that all players see the right in-game view based on their assigned role—driver or shooter.
I began by implementing two basic camera systems:
- A Driver Camera that follows the vehicle from a third-person viewpoint.
- A Shooter Camera that is positioned based on the turret's direction and movement.
These were okay locally, but not network-aware. To get this to scale up to multiplayer, I implemented a VehicleCameraManager. This system dynamically determines each player's role upon joining the game and permits the correct camera accordingly.
During runtime, the VehicleCameraManager performs the following:
- Determines if the local client is the driver or the shooter for a specific car.
- Enables the appropriate camera for that role (DriverCamera or ShooterCamera).
- Disables the default camera of the Unity scene to avoid rendering conflicts.
- Ensures only one active camera per client, keeping the view accurate and immersive.
This camera activation based on roles helped in reinforcing the cooperative nature of our game. It also removed the need for manual camera setup in the scene, making the system fully automated and scalable to future vehicles or roles.
While integrating the camera logic with role assignment, I ensured that each player's perspective is both correct and immersive, but cleanly synchronized with our networked setup. This also simplifies adding new roles, as each camera will activate automatically without requiring manual setup.
The DriverCameraController script controls the third-person follow camera for players who are set as the driver. It smoothly follows the car's position and rotation using Vector3.Lerp and Quaternion.Lerp, with an offset behind and above the car, so it can be seen. This camera improves the driving experience by delivering a wide field of view without changing orientation during motion. The reason I did this independently was to give the driver a clear, fixed point of view based on maneuverability without interfering with shooting or aiming mechanics.
The ShooterCameraController provides a shooter-perspective view that tracks the movement of the turret. It reacts to the mouse by y and pitch values, which control the horizontal and vertical rotation of the turret and camera. This system gives the shooter accuracy for hitting, and I designed it so that it would be responsive and immersive. By making the rotation of the camera directly correspond to turret parts (cannon base and head), the player gets visual feedback that mirrors their input in real time. This was essential to making shooting feel natural with turret mechanics.
The VehicleCameraManager is a multiplayer-aware manager that dynamically activates the appropriate camera (Driver or Shooter) based on the player's assigned role in a given car. It deactivates unused cameras and also turns off Unity's default main camera to avoid overlap or wrong views. This script was tasked with converting the camera systems within the local environment to a completely networked solution. Rather than manually having to toggle cameras or static setups, the manager programmatically determines player roles through clientId and sets the correct camera per user automatically. This assures that each player gets the right view upon spawning, keeping the feel smooth, clean, and scalable for future development.