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 - Unity 3D Tutorial
From the course: ARKit and Unity: Build a Drivable Car in Augmented Reality
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
How are we going to do it?56s
-
(Locked)
Wheel colliders, part 16m 8s
-
(Locked)
Wheel colliders, part 22m 30s
-
Adding the car model5m 35s
-
(Locked)
Rear-wheel drive script, part 19m 57s
-
(Locked)
Rear-wheel drive script, part 27m 2s
-
(Locked)
Adding touch controls10m 44s
-
(Locked)
Resolving some bugs and running the app9m 24s
-
(Locked)
-