Search Unity

Minimap :O

Discussion in 'Editor & General Support' started by YourMother999, Jul 23, 2010.

  1. YourMother999

    YourMother999

    Joined:
    Jul 11, 2010
    Posts:
    115
    Hey guys. i am wondering if somone could tech me how to make a minimap or somthing for my RPG game? It would be GREATLY appreciated and your name would be included in credits if desired :D thanks!!
     
  2. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    Recently discussed here.
     
  3. Rman

    Rman

    Joined:
    Jun 6, 2010
    Posts:
    147
    Just add a camera, set its height to be the players height plus a variable(expose this for adjustment), make the map size small(see the unity reference for cameras), change its order so it floats above the other window, and have a smoothlookat player script.
     
  4. YourMother999

    YourMother999

    Joined:
    Jul 11, 2010
    Posts:
    115
    tried it, didnt help :eek:
     
  5. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    Ok. So what do you need help with then?
     
  6. joel

    joel

    Joined:
    Jun 12, 2010
    Posts:
    117
    Again a post by this guy?!
    And again he's just requesting things without having done any searching.
     
  7. Rman

    Rman

    Joined:
    Jun 6, 2010
    Posts:
    147
    See Following
     
  8. Rman

    Rman

    Joined:
    Jun 6, 2010
    Posts:
    147
    1) Select GameObject Menu - Choose Create Other - Camera

    2) Create a new script, edit the script and paste my code in saving it as 'Orbitcam' or something similar

    Code (csharp):
    1. var target : Transform;
    2. var damping = 6.0;
    3. var smooth = true;
    4.  
    5. function LateUpdate () {
    6.     if (target) {
    7.         if (smooth)
    8.         {
    9.             // Look at and dampen the rotation
    10.             var rotation = Quaternion.LookRotation(target.position - transform.position);
    11.             transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
    12.         }
    13.         else
    14.         {
    15.             // Just lookat
    16.             transform.LookAt(target);
    17.         }
    18.         transform.position.y = target.position.y + 90;
    19.         transform.position.x = target.position.x;
    20.         transform.position.z = target.position.z;
    21.     }
    22. }
    23.  
    24. function Start () {
    25.     // Make the rigid body not change rotation
    26.     if (rigidbody)
    27.         rigidbody.freezeRotation = true;
    28. }
    Click on the camera you created in the editor, and drag the script onto it.

    In the attached Orbitcam script which is now attached to it(in the inspector), there is a variable for 'target', set this to be the player you want to look at(important)

    Now the camera is set up, however it many be displaying underneath the main window, to fix this set its Depth value to anything above 1, try 2,3,4 if 1 doesnt work. The depth value needs to be higher than the depth value of the main camera or it would be underneath.

    The values in the inspector for guidelines should be set to



    I almost forgot, dont credit me just have a link somewhere to my blog http://www.planet44.wordpress.com the game is called Planet 4.

    Edit: Use orthographic off and a field of view of about 10, or use orthographic on and use a orthographic size of same. Change this value for the view distance. Clearly you can also play with the map parameters to customise to your requirements.
     
  9. YourMother999

    YourMother999

    Joined:
    Jul 11, 2010
    Posts:
    115

    FYI i did search and i cant find any help.
     
  10. Guru

    Guru

    Joined:
    Apr 30, 2010
    Posts:
    118
    I haven't seen your other posts but I can see how it can seem you didn't search since your post doesn't ask anything specific and another in this thread just saying it doesn't work. Not being rude, just be more specific in your questions and it will get you a lot further instead of seeming like you want someone to do the work for you.

    But the post up above should get you going.
     
  11. •BTM

    •BTM

    Joined:
    Jun 6, 2010
    Posts:
    108
    a minimap isn't that hard to do at all. you just need to make a texture representing your map, and know the comparison from 3d units to 2d pixels.

    For example, this map has dimensions of 50x45, which start at -20x-10, and go to 30x35. The image I made represents this as 180x162 pixels. so, when I use each enemy's x and z coordinates to represent them on the minimap, I multiply them by 3.6 and subtract half the dimensions of the texture representing them. also, because the y coordinates are from the top down, they must be represented as the height minus what the dimention is. basically, in my case, each dot is represented as
    Code (csharp):
    1. Rect((i.transform.position.x+20)*3.6 + Screen.width-180 - 8,Screen.height-((i.transform.position.z+10)*3.6) - 8,16,16)
    Getting the positions on the screen right requires you to think a bit, but it isn't all that hard.

    (This map system isn't in the web player yet.)
     

    Attached Files:

  12. Rman

    Rman

    Joined:
    Jun 6, 2010
    Posts:
    147
    Yes mine is just a simple overhead camera, creating a proper minimap might be better it was just the simplest solution

    Ceilings can be added to layers and then opted out of the cameras display layers, or you can even attach a dot to the player, and simply only render dots, this might be even more elegant.

    Actually thats a brilliant idea. I am amazing. In particular, it becomes a function of the graphics card rather than the processor which is always good.
     
  13. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    im searching for a minimap something like in halo. to detect players and AI's (tags) and show theyre distrance (to have max and minimum distrance)
     
  14. nevaran

    nevaran

    Joined:
    May 21, 2010
    Posts:
    247
    im searching for a minimap something like in halo. to detect players and AI's (tags) and show theyre distrance (to have max and minimum distrance)
     
  15. Jesse Anders

    Jesse Anders

    Joined:
    Apr 5, 2008
    Posts:
    2,857
    It looks like there are some good suggestions in this thread. There's also a link to another thread that you could look at as well.

    I'd recommend looking through all of the materials presented here, and then if you get stuck on something, post here (or, maybe better, start a new thread) with any specific questions you have.