From the course: ARKit and Unity: Build a Drivable Car in Augmented Reality

Unlock this course with a free trial

Join today to access over 22,700 courses taught by industry experts.

Rear-wheel drive script, part 1

Rear-wheel drive script, part 1

- [Instructor] In this video, we are going to write some code to drive the car. First of all, let's just drag the car body inside the Car Parent as it is the part of the actual car. Close the Car Parent and we are going to attach a script on Car Parent in which we are going to write some code which will make the car drivable. So, let's do that. First, let's create a script. Go to Assets, right click, Create, Folder, and name this Scripts. Open the folder, right click, Create, C# Script and name this RearWheelDrive and now I'm going to attach this script on Car Parent. So, click on Car Parent, drag the script right here. Now let's write some code inside this script. Double click to open. It might take some time. First, let's create two variables. Public float maxAngle equals to 30. Public float maxTorque equals to 300. The variable maxAngle equal to 30 is used to denote now the wheels of the car will be able to turn a maximum of 30 degrees and the variable maxTorque equals to 300 is…

Contents