position indicator for car in racing game ?

how to make the position indicator for racing games,which shows the current position of the player(car)…

anyone please.

It depends how you’re displaying the minimap (that’s what you’re talking about right ?). I will assume it’s a GUI. Here is what I would do :

  • Set an empty gameobject at the 3D position (let’s call it A) which represent your minimap’s top left corner. The y doesn’t matter. It’s likely to be the corner of your terrain. Set another gameobject for the bottom right (B).
  • Find the position of the car in A’s space, with transform.InverseTransformPoint. Then, Divide it by the magnitude of the vector [AB]. IF it’s not a square, divide separetely x and y. Now you have the car’s position in your GUI relative rect’s space, between 0 and 1.
  • Finally, multiply that by that rect’s size.

I have no idea if it works !

do you mean rank detector sir?

maybe we could use trigger detection… if a car pass through another’s trigger the passing objects would rank up high and the object that has been passed lose one position… nah not quite sure just a thought…

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 Unity Asset Store - The Best Assets for Game Making