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 thanks!!
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.
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): 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; } 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.
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.
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): 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.)
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.
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)
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)
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.