Project: Cars

Software Used: Unreal Engine 4
Languages Used: Blueprints, C++

Overview

After playing Forza Horizon 4, I was intrigued by the cars' controls and behaviours in the game. I wanted to learn about the game, its development and how such a responsive vehicle controller that provides the same experience as driving an actual car was developed. I started by watching behind the scenes videos of the development of Forza on YouTube and learn about the fundamental physics involved in a functioning car. I felt like there was a lot to explore and learn.


This turned into a sort of obsession of overcoming each challenge that was put before me to understand how each component of a car works in real life and the process of converting them to virtual components in Unreal Engine. To further make this project visually captivating, I used Lego inspired by the Forza Horizon 4: Lego Speed Champions expansion.

Suspension

Slip Angles and Transient Longitudinal Forces

Sliding is prevented along the slope in the lateral and longitudinal direction when the clutch is engaged.

Physics Substepping

For smoother movement controls, I realised that the physics need to be calculated with high frequency and I enabled physics substepping within the project settings. However, the default pawn's tick event is still not enough. Therefore, I used a MMT Pawn class for the car instead of Unreal Engine's default pawn class as it has a substep tick event that is called on each sub step which is not avilable in the default pawn class.

Transmission Modes

The mode of transmission can be customised to either Automatic or Manual transmissions to suit the player's experience and preference.

Drivetrain Assembly

The following code is used to update the physics of the wheels. This can be used to customise the drivetrain of the vehicle to make it Front Wheel Drive (FWD), Rear Wheel Drive (RWD) or All-Wheel Drive (AWD). The code snippet below shows an example for a RWD vehicle.

Camera System

There are 2 camera view; Chase View and Cockpit View.
Chase view: Third-person view of the car with camera lag and camera rotation lag enabled enforced by a maximum distance that the camera may lag behind the current location.
Cockpit view: First-person view inside the car, directly through the eyes of the driver and does not not have any camera lags.


Credits