Simple Car Controller in Unity Tutorial



[UPDATE] If you are looking for the breaking bugfix check the description after expanding it!

Let’s learn how to create a car controller in Unity. We will get to know Unity’s wheel collider component and use it to move a car. We will also create a simple camera script that will follow the car.

[BREAKING BUGFIX!!]
There is a bug in the HandleMotor() method in the CarController.cs. The “if (isBreaking) check should be removed. The fix is also pushed to the GitHub repository. The method should look like that:
private void HandleMotor()
{
frontLeftWheelCollider.motorTorque = verticalInput * motorForce;
frontRightWheelCollider.motorTorque = verticalInput * motorForce;
currentbreakForce = isBreaking ? breakForce : 0f;
ApplyBreaking();
}

Used assets:
ARCADE: FREE Racing Car
https://assetstore.unity.com/packages/3d/vehicles/land/arcade-free-racing-car-161085

by: iMENA Games
https://assetstore.unity.com/publishers/35682

Grab the whole project from GitHub:
https://github.com/GameDevChef/CarController

Source

KA2Studio
Logo
Compare items
  • Total (0)
Compare
0