|
how to make the position indicator for racing games,which shows the current position of the player(car).... anyone please.
(comments are locked)
|
|
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 :
I have no idea if it works ! sorry sir, i didn't understand your answer :( actually am asking this (http://i39.tinypic.com/1fi6ph.png) please help me. thank u....
Mar 18 '12 at 11:06 AM
Dee Va
Even i have the same problem :(
Jul 17 '12 at 01:53 AM
Bhasker reddy
Oh, right. I was thinking minimap apparently. The easiest way (ok, the only one) I see right now, is to have waypoints all along the race path, sorted from start to end. Each frame, each car search the closest waypoint. Best case scenario, all the cars have a different waypoint, they are already sorted. But you can have several cars with the same point, in which case you need to calculate how close they are from the next one. I can develop that part if need be.
Jul 17 '12 at 02:01 AM
Berenger
Even I didn't solved this problem,@Berenger Any Reference script's about this please because I have no idea how to do that, thank you :D
Jul 17 '12 at 02:54 AM
Dee Va
I'm afraid it was off the top of my head. I'm assuming you already have several cars running against each other, either multiplayer or AI, create a basic race with a single straight line, with at least 2 vehicles (let's call them A and B). Create the start at (0,0,0), end at (0,0, 100). Then create 5 empty GO, set them at z == 0, 25, 50, 75 and 100. In your vehicle script, create a public transform array var, and assign those 5 GO, by increasing z order. At runtime, inside the HUD script (which is attached to only one object, by opposition with the vehicle script I spoke earlier), loop through all the vehicles to find the index of their closest point. If A is at z == 47.89 and B is at 86.41, A's index is 2 and B's is 3. 3 > 2, B is first. Note that this could be done by comparing the z of each vehicle. But this case is very specific, and the path in a race turns and turns, that's why you need waypoints. I suggest you do that first, then try to think about the worst case scenario, for instance A 47.89 and B 53.66, which gives the same index for both.
Jul 17 '12 at 04:31 AM
Berenger
(comments are locked)
|
|
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..
(comments are locked)
|
