Skip to content

The Track

Vladimir Mikulik edited this page Mar 25, 2018 · 3 revisions

The track is kept track of by the Track Controller Object.

Currently, it has two notable features:

  • A component script, Track Controller, which is the interface to information to do with the track
  • A GameObject Markers which contains all of the track markers in order.

Track controller

The track controller contains an array of the individual marker GameObjects, exposing two ways of interacting with that array:

  • LastVisited, the index in that array of the marker last visited by the car.
  • GetNextMarkers(n), which returns an array of the positions of the n next markers the car has yet to visit along the track. (This method hasn't been tested yet)

LastVisited is maintained by detecting collisions between markers and the car's collision box. Each marker has a reference to the Track Controller, so when it detects the car has entered it, it updates the index accordingly.

Clone this wiki locally