Press key to start a car

Hi everyone,:smile:

Can someone tell me how do I make a car when press for example the β€œE” key to get start.:face_with_spiral_eyes:

I have a start sound of a car, and I want press a key, than play that sound and the car start move whean I press forward key.

Any help I appreciate.:smile:

public var startSound : AudioClip;

function Update() {

	if (Input.GetKeyDown(KeyCode.E)){
		audio.PlayOneShot(startSound);
		StartCar();
	}

}

function StartCar(){
	//put script here to start engine
}

Unfortunately I can’t tell you exactly which steps to take, you have to figure things out for yourself but this is an example to give you a general idea. You should read up a little about basics of scripting.

Look at input.getkey in the docs and either translate your car or add force, but there’s a lot more to moving a car then that I’d suggest looking at the car tutorial

Yes there’s a lot more to it. So here is some candy :slight_smile:

http://www.gotow.net/andrew/blog/?page_id=78