- Home /
car game questions
hello
i am making a racing game after following alot of tutorials and it's nearly finnished but a still missing a few things
1- i downloaded the prefab in this url http://forum.unity3d.com/threads/638...eedometer-dial but i didn't know how to install it can any one explain to me how to move it and how to connect it with the car
2- how to put a car position in the game
3- how to put lab counter
thank you ^-^
Answer by LightSource · Feb 25, 2013 at 10:13 PM
Please explain lab counter and car position. Do you mean LAP counter? Do you mean when the car finishes it lists its place?
Lap counter:
var laps = 0;
var pass = 1;
var total = laps + pass;
function OnTriggerEnter () {
laps = laps + pass;
}
function Update () {
Debug.Log("Laps: (total)");
}
Make a cube, Turn off mesh renderer, Make it a trigger, Attach script, Now every lap the cube will count up and display it in the debug log.
Also, I'm not sure where you got the download from in the URL.
Car place:
var place = 1;
var finished = 1;
var otherCar;
var finish;
function OnCollisionEnter (otherCar : finish ) {
place + finished;
}
function Update () {
Debug.Log("Your place is: (+place)")
}
If the script has errors, sorry, I'm still learning as well.
Your answer
Follow this Question
Related Questions
Speedometer rotation problem 1 Answer
how to rotate car to camera direction using wheel colliders. 1 Answer
Animation in GUI Buttons? 1 Answer
Saving name of player in high scores? 0 Answers
drift car using rigidbody 1 Answer