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 rikkert88 · Jul 04, 2012 at 03:25 PM · playerminimapdot

Minimap player dot

Hey,

How to make the player as dot on your minimap?

Here is the code without dot:

     var target : Transform;
  var damping = 6.0;
  var smooth = true;
  
  
 function LateUpdate () {
    if (target) {
      if (smooth)
      {
        // Look at and dampen the rotation
        var rotation = Quaternion.LookRotation(target.position - transform.position);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
      }
      else
      {
        // Just lookat
          transform.LookAt(target);
      }
      transform.position.y = target.position.y + 90;
      transform.position.x = target.position.x;
      transform.position.z = target.position.z;
    }
  }
  
 function Start () {
    // Make the rigid body not change rotation
      if (rigidbody)
      rigidbody.freezeRotation = true;
  }

 
 
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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by DerWoDaSo · Jul 04, 2012 at 03:42 PM

I guess this script is attached to a camera, which renders the scene from above?

A simple solution might be to create a big dot-like object (like a sphere or better simpler) and attach it to your player (a little bit above maybe). Then set the layer and the culling mask for the minimap camera and the main camera accordingly, so that the "dot" is only rendered on the map.


EDIT:

Of course there are several possible solutions for this. But they depend on how you setup your minimap...

  • Is it a camera which is rendering the whole scene from above?

  • Is it an image of the level which is displayed centered around the player?

Last time I created a minimap, I used NGUI to show an image (editied screenshot of the scene from above) with little sprite icons (dots, arrows) for different items on the map.

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
1

Answer by marcfielding · Feb 18, 2014 at 12:12 PM

Yep!

Two ways I can think of:

1) Use SphereCast (docs are pretty straight forward) to locate each player from the camera above and then place a gui element on that camera for each player

OR

2) Create an array of gameobjects (players or NPC's etc) and have a script attached to the minimap camera, then simply wizz through it grab their positions and add Gui elements for the minimap to represent their position.

I'd imagine you don't want everything appearing on the minimap all the time(ie you want radar type effects) so either of these would work well, i'm not sure on how expensive SphereCasting is in terms of processing power.

EDIT I've just re-read you question, sorry i've just woken up! If its JUST the player you want then attach a script to your minimap camera and in the Start() function store a reference to your players gameobject.

Then in update simply add a gui element(your dot) to the present position of the player!

If you need more clarification let me know and i'll be happy to help!

Good Luck!

Marc

[1]: https://docs.unity3d.com/Documentation/ScriptReference/Physics.SphereCast.html

Comment
Add comment · Show 2 · 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 DerWoDaSo · Feb 18, 2014 at 12:23 PM 1
Share

The "Edit" solution will work fine of course, but I would do 'FindObjectWithTag("Player")' once in Start() and store a reference to it. If your player changes, just nofity the $$anonymous$$imap script. :)

avatar image marcfielding · Feb 18, 2014 at 12:31 PM 1
Share

Yeah good catch DerWoDaSo edited accordingly, thanks!

avatar image
-2

Answer by KhShani · Feb 18, 2014 at 09:14 AM

the above solution worked but but is there is another solution for this ????

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 DerWoDaSo · Feb 18, 2014 at 10:51 AM 0
Share

I edited my answer above. There are many possible solutions for this problem. $$anonymous$$y initial answer was just the most simple one, which came to my $$anonymous$$d at that moment. ;)

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

7 People are following this question.

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

Related Questions

MiniMap with player and object icons 1 Answer

How to align an object's rotation to another GameObject's rotation (without parenting the Objects) 1 Answer

Change Player MiniMap Icon 1 Answer

Drawing a GUIBox on player/enemies in MiniMap 0 Answers

Mini Map that displays Players X,Y,Z coordinates 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