- Home /
How do I make a car in unity?
I've set up a car in unity3d 3.0 following this tutorial really closely http://www.gotow.net/andrew/blog/?page_id=78 and I want to make it go now, but the tutorial sort of assumes I know something about scripting, and really don't know a single thing so I'm pretty stuck...
So if anyone could help me out just setting up some controls to make it drive-able that'd be greatly appreciated!
Please note that I'm completely new to the idea of scripting, sorry!
Answer by Yoerick · Nov 14, 2010 at 09:00 PM
You could use a combination of pre-made scripts that are included in the Unity package. For what I understand, you want to make a Third Person Controller, this can be achieved by adding a movement script to the object and a camera follow script to a camera that will follow your car.
These are two scripts that are already written for you. Open your Unity project, go to "C:\program files\Unity\Editor\Standard packages" and double click the "Character Controller" and the "Scripts" unity packages. This will import the standard scripts into your current Unity project.
Now select the camera you want to follow the car. Go to Component -> Camera Control -> Smooth Follow. This will add the smooth follow script to your camera. Go to the script component and you should see a variable "Target" which is set to "none". Drag your object to this field. Now the script will make sure your camera allways looks at the car and also follows it. You can also adjust some variables like height and distance.
For the movement there's also a standard script called "FPS Input Controller". Select your car you want to move, go to Component -> Character -> FPS Input controller.
When you've added these two scripts you already have a basic Third Person controller.
However, writing your own Third Person Controller script is advised if you want to accomplish a specific effect. Here's a handy link: Third Person Controller. Especially page 4 is probably intereseting for you ;)
hope it works
Your answer
Follow this Question
Related Questions
if moving statement 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
add force get stronger over time slow. 2 Answers
WheelColliders Bug Fix 0 Answers
How to set max speed for this car ? 1 Answer