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
2
Question by Bob5602 · Feb 08, 2011 at 08:49 PM · distancespaceminimapoverlayradar

Making a 2d "radar" for space game

Hello all -

I am making a space turret defense game, and my main ship is going to be the center of the action. However, I want to make a 2d overlay minimap / radar type thing so that players can see where the enemies are in relation to the main ship. The idea would be that the radar is a circle with lines denoting distances, such as the main ship in the middle as an Arrow or something, then a circle around that meaning 500 meters, another for 1000 meters, etc. I have enemies spawning all over around the ship, and above it. How would I translate their positions around the ship on the grand scheme of things to a small dot that moves on the "radar" ?

I would need some kind of conversion of distance that dis-regards up/down movement (so radar is 2d) but still keeps the relative distance away from the main ship so its actually reliable. I would hope to make something that can have different color dots on the radar for different enemy types, with size being relative to the enemies size.

How would I begin to code something like that? I'm not asking for anyone to write it for me, but a few points on how I could make a system like that work would be great.

Thanks! Marcin

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by hellcats · Feb 08, 2011 at 09:07 PM

I'm only starting out with Unity, but what you're describing is essentially the rendering problem, only targeted to a map instead of the entire screen. So you could approach it that way and build a transformation matrix composed of translation, scale and projection matrices (see the OpenGL redbook), and a separate Camera to render your 2D objects. Unity even has render to texture capability which would completely solve your problem, but it is a Pro feature. You can easily set this up though without using render to texture.

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 Jesse Anders · Feb 08, 2011 at 09:47 PM

I'm not sure how you want the radar to function (e.g. fixed orientation, relative to the player, etc.), but in each case, transforming the positions of interest to 'radar space' will be similar.

If, for example, the radar has a fixed orientation and is aligned with a cardinal plane, you would simply project the positions onto that plane by zeroing the appropriate component. If on the other hand the radar is always relative to the ship, you'll use Transform.InverseTransformPoint() to transform the positions to local space, and then again zero out one of the elements to project them onto the ground plane.

At this point you have the 'radar position' for each object, but not necessarily scaled appropriately. Scaling however will be a simple linear mapping based on how many 'radar units' equals one world unit.

For rendering, there are several approaches; searching Unity Answers and/or the forums for 'minimap' should turn up some relevant discussions on the topic.

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

No one has followed this question yet.

Related Questions

Render 3D object to a 2D texture at runtime 1 Answer

MiniMap Border! 1 Answer

Marge Radar With MiniMap 1 Answer

Minimap rotation 1 Answer

"How far to the local left/right is another object"? 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