Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by ramymaher · Oct 11, 2015 at 03:05 PM · uidirectionnavigationmapminimap

Minimap North Direction

I have managed to make a minimap and rotate the higher camera according to the FPS. Now I need to add an arrow that signals north on the map. The minimap is a rectangular box, so anything that is circular won't work.

Also I need to add pins that are always present on the map; for example to show the place where a hospital is. I can add it to the minimap, but how do I always keep it on the screen even if it is out of the borders of the minimap??

Here is the script I have so far.

var minimapCamera: Transform; var target: Transform; public var height=250;

function Update () { minimapCamera.position= target.position+ Vector3(0, height, 0); //minimapCamera.rotation= new Vector3(0, target.rotation.y, 0); transform.eulerAngles.y= target.transform.eulerAngles.y; }

Comment
Add comment · Show 2
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 Patroclo · Feb 22, 2017 at 04:49 PM 0
Share

Same problem here!

avatar image RobAnthem · Feb 22, 2017 at 05:36 PM 0
Share

I know it isn't exactly optimal, but short of writing a very complex $$anonymous$$imap system, there is one simple way to do it... Create a specific Layer of objects that is only visible to your $$anonymous$$imap camera, allowing you to place literally anything in your world that only the camera can see. Like text, pointers, arrows, etc.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by jdean300 · Feb 22, 2017 at 05:46 PM

I haven't tested the solution below, but it seems like it should work to me. This will determine the position of pins on the map.

I assume you can get the direction to the pin from the center position of the map (presumably the player), lets say that is Vector3 pinDirection. What you need to do is calculate the point on the square border of the map in that direction. First, normalize the direction: pinDirection.Normalize(). Now scale this vector so that the larger of it's components has the value of the maps dimensions on that axis.

 Vector3 pinDirection = // get this somehow
 pinDirection.Normalize();
 
 float scaleFactor;
 if (pinDirection.x > pinDirection.y) {
     scaleFactor = mapDimensions.x / pinDirection.x;
 } else {
     scaleFactor = mapDimensions.y / pinDirection.y;
 }
 
 pinDirection *= scaleFactor;
 Vector3 pinPosition = pinDirection + map.center;


This may not work if your map is not square - in that case you can probably multiply the pinDirection components by the ratio of the maps dimensions.

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

6 People are following this question.

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

Related Questions

Input Field issue with UI navigation system 0 Answers

How to create a dynamic map in hand of FPS like Far Cry 2 or Firewatch? 0 Answers

How to fix object on the map on unity mapbox? 0 Answers

Prevent MultiplayerEventSystem going to another playerRoot 0 Answers

Any way to define a navigation group with the UI system? 1 Answer


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