Ok well it’s not so much scripting help as helping work out the general logic.
Basically I have a racing game, and I’m trying to have it calculate the players position in the race, but I’m un-sure of how it is normally done. Im coming up with fairly primitive ideas involving having a big box collider with a trigger on attached to the player and work it out based on the enemy racers collission with the box, however this obviousally wont be particularly accurate.
Usually you keep track using checkpoints and the car’s distance from the next checkpoint.
Every correct checkpoint would add to the vehicle’s counter which would be the first check of position. In order to break up ties, the next checkpoint checks the cars’ distances from it.
Gargerath’s suggestion sounds like the best way of doing this.
An additional suggestion I thought of would be to divide up your track between checkpoints trying to make a new checkpoint for each relatively straight section of track regardless of the section’s length, as this would help to avoid confusion with the distance calculation.
By that I mean a straightaway would have few checkpoints, whereas a very twisty section would need more checkpoints more frequently (i.e. checkpoints too far apart through a really twisty section and a player could be closer to the checkpoint marker in absolute distance even though they’re further back on the track, which would throw off the placings).
Exactly! Keep in mind that these don’t necessarily have to be the checkpoints that the player is driving under. They could be invisible trigger walls at regular intervals.