Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Dee Va · Feb 26, 2012 at 10:52 PM · positioncarindicator

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Berenger · Feb 27, 2012 at 12:56 AM

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 !

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dee Va · Mar 18, 2012 at 11:06 AM 0
Share

sorry sir, i didn't understand your answer :( actually am asking this (http://i39.tinypic.com/1fi6ph.png) please help me. thank u....

avatar image Bhasker reddy · Jul 17, 2012 at 01:53 AM 0
Share

Even i have the same problem :(

avatar image Berenger · Jul 17, 2012 at 02:01 AM 0
Share

Oh, right. I was thinking $$anonymous$$imap 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.

avatar image Dee Va · Jul 17, 2012 at 02:54 AM 0
Share

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

avatar image Berenger · Jul 17, 2012 at 04:31 AM 1
Share

I'm afraid it was off the top of my head. I'm assu$$anonymous$$g 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.

Show more comments
avatar image
0

Answer by vanofthedawn12 · Jul 17, 2012 at 03:25 AM

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..

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by vanofthedawn12 · Jul 17, 2012 at 03:23 AM

do you mean rank detector sir?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dee Va · Jul 17, 2012 at 12:55 PM 0
Share

Exactly :D

avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make a Race Standing / Position Indicator 0 Answers

problem wheel position 1 Answer

Making a race car positioning system 5 Answers

Camera rotation around player while following. 6 Answers

Car's position indicator or Standings . 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges