- Home /
Beginner Car Control Script from FlatTutorials
Obviously, Im a beginner Unity program and I've started a racing game using this tutorial (specifically this part of the tutorial): http://www.youtube.com/watch?feature=player_embedded&v=hIWBd7jpcyA
So far, I've been able to apply wheel colliders, box colliders and basic. The script he supplies for car movement though, doesnt make my car move. What am I supposed to press to make the car move (arrow keys? WASD?) and is there anything wrong with the script itself. Here is the script:
pragma strict
var wheelFL : WheelCollider; var wheelFR : WheelCollider; var wheelRL : WheelCollider; var wheelRR : WheelCollider; var maxTorque : float = 50; function Start () { rigidbody.centerOfMass.y = -0.9; }
function FixedUpdate () {
wheelRR.motorTorque = maxTorque * Input.GetAxis("Vertical");
wheelRL.motorTorque = maxTorque * Input.GetAxis("Vertical");
wheelFL.steerAngle = 10 * Input.GetAxis("Horizontal");
wheelFR.steerAngle = 10 * Input.GetAxis("Horizontal");
}
(Sorry about the fonts)
Also, looking at out tutorials, they suggest using gear ratios, max and min engine RPM. Should I include these as well?
Thanks David
Answer by Graham-Dunnett · May 21, 2013 at 09:40 AM
The documentation for Input.GetAxis()
may give you some clues:
http://docs.unity3d.com/Documentation/ScriptReference/Input.GetAxis.html
Answer by m.abdullah279 · Nov 05, 2014 at 04:33 AM
Stop spam$$anonymous$$g answers to boost YouTube views. $$anonymous$$ods need to close this and ban you.
Your answer
![](https://koobas.hobune.stream/wayback/20220613102638im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make camera position relative to a specific target. 1 Answer
Events triggered by button pressed. 2 Answers
Simple 2D Car Game 3 Answers
How do I add controls? 2 Answers
Driving car FPS 1 Answer