- Home /
Vector Based - Mini Map
Hello,
I've been looking around the Unit forum for advice on a Mini Map for my game. But I mainly come across the same advice, which is to add a second camera to your scene, mask some renderers and reposition the view.
But thats not really what I am looking for. I want something more vector based, so a drawing of my entire map (done on a large canvas in Photoshop), that either:
Has an arrow in the centre of it, thats always pointing upwards (the arrow is the players direction), and the vector map rotates around the player according to the direction of the player, and moves in the direction too.
OR, the arrow rotates according to the players position (instead of the map rotating around us), and again, the map moves in the direction according to the player. (I prefer this idea)
Now, like I said, the map is just a vector based drawing in Photoshop, thats imported as an image thats going to be drawn on the OnGUI, right?
And the image (texture) coordinates moves according to some kind of formula that takes into account my players position. First off, I have no idea what that formula would be, and also, I would like my Mini Map to be in position top right of my game window... The problem I'm getting straight away, is that my entire map canvas is being drawn over my game, and not just a little square (top right), how would I mask a square looking mini map?
Thanks!
Answer by Tim-Michels · Jun 20, 2012 at 02:27 PM
I would suggest the following:
Make a seperate (isometric) camera for the minimap.
Setup a custom normalized viewport rect, to make the minimap camera as a part of your view.
Place your large canvas texture on a plane, high above your world.
Make sure your canvas matches the world scale. (check with isometric top view)
Add code for your camera to set it's x and y position equal to your character
This is a pretty simple way of doing this, don't know if it matches your needs. Hope it helps.
Greets
Thanks tim, how would I prevent the entire map canvas from showing on my plane? As I move in the game, I want the plane/map to move too (the map is zoomed in)
You setup your isometric camera to take up only a part of your screen. Experiment with its normalized viewport rect to make it only a part of the screen. That way, your map that is rendered by the isometric camera will only be shown inside your custom view rect.
edit You can also change the "size" parameter of your isometric camera to alter the "zoom".
Hope this helps.