- Home /
Car's position indicator or Standings .
Hello, My friend and i started making a racing game from past Week,But we got a problem about showing position of the car on gui.
This hoto gives you more Idea what i was asking about marked with green color :D
Help me please thank you :D and have a good day :D
Answer by Meltdown · Jul 16, 2012 at 06:49 PM
There are several ways to approach this..
Create a set of waypoints around the track. With each waypoint having a progress value. In your Update() method you can keep checking which waypoint is closest to each car. The car closest to the most further waypoints on the track, that has the most laps is the leader. But this method is not always accurate, especially if you have tight corners or tracks where a waypoint on another part of the track may be closer to a car than the closest waypoint to him on his part of the track.
Create a set of box colliders around your track (very tedious job), each time your car collides with the box, use the box's name to determine how far the player's progress is on the track. So you can call them box1, box2 etc. This is the most accurate method I can think of.
Any example Script on 2 option please :D thank you very much
It's pretty easy to figure out. As each collider gets touched, just get its name, then replace box out the name to get the numeric value. If there are 200 colliders in the scene.. for each lap the player has done, add 200 to the total.
You totally misunderstood Sir,what i was actually asking is car [player] position i mean if they are 4 opponent cars when the race start ...i would like to show where the player position in between the opponents i mean like 1/4 if player was first in the game or like 4/4 if player was last.... to avoid confusion i posted the photo :D hope you help me Sir :D
I understood exactly what you are saying and that is exactly what my solution proposes. You base car position on the total value of colliders passed + (number of laps * colliders per lap).
How should i deter$$anonymous$$e Aicar sir?? let's assume that player was at 4/3 ["4" is the opponents and "3" is the player position in race ],if player get passed away from Aicar How should i deter$$anonymous$$e it like 4/2.. beside am just 13 year's old..difficulty in understanding these things .... so if you get solution please be more specific so that i can understand totally Sir :D....
Answer by kapyar · Feb 09, 2016 at 05:14 PM
Hey, you could try my plugin which can handle all math. Its really simple to use you must add only 2 prefabs to your scene https://www.assetstore.unity3d.com/en/#!/content/45698
Your answer
![](https://koobas.hobune.stream/wayback/20220613074243im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Show laptime after each lap ? 1 Answer
problem wheel position 1 Answer
How do I make laps in a racing game? 5 Answers
Making a race car positioning system 5 Answers