Mini-Map Display

Hi,

What I would like to do is to display a Mini-Map that is smaller than my actual terrain. I would like to display the scaled down terrain as a non-moving GUI at the approximate coordinates: x = 960, y = 340, with width as 280, and length as 210 (pretty much the bottom-right hand corner of the screen).

To acheive this, I could scale the terrain down to roughly meet those values, but when it comes time to display a player indicator (the 2D texture) for as the player is moving, the coordinates do not coorrespond, in other words, it is inaccurate.

What I can do is just draw a GUI Box where I need it to be, scale down the position of the player and also the terrain to conform to where I want the GUI Box.

The code below is inaccurate

void OnGUI()
{
    //Scale the "Top-Down" View of the terrain down by 0.8f and 0.4f    

    GUI.Box(new Rect(Mathf.Abs(MyTerrain.position.x) * 0.8f, Mathf.Abs(MyTerrain.position.z) * 0.4f, 300, 225), "");    
    GUI.BeginGroup(new Rect(Mathf.Abs(MyTerrain.position.x) * 0.8f, Mathf.Abs(MyTerrain.position.z) * 0.4f, 300, 225));        
        //Draw our Player Indicator Texture (PlayerWidget) For when the Player Moves.        
        GUI.Label(new Rect(Mathf.Abs(PlayerPosition.position.x) * 0.3f, Mathf.Abs(PlayerPosition.position.z) * 0.3f, 200, 200), PlayerWidget);    
        //Try to draw a game object at a known positon on the terrain
        GUI.Label(MyGo.x, MyGo.z, 200, 200), GoTexture);
    GUI.EndGroup();

}

Edit -- How could I get game objects that do not move to show up accurately?

I would avoid using GUI Textures for your player indicator when you also used a terrain for the map. Then, you don't want to use a scaled version of your terrain, because that will give you poor performance. Grab a screen shot of the terrain and apply it to a plane or cube then have a second camera that renderers only the plane/cube. Then place an indicator object such as a sphere or a plane on top.

You can scale the second camera's normalized viewport rect to have it fit in the shape you want. Then I would use the script I wrote in this tread to have your indicator line up with the player.

One last point is that if you use GUI for your mini-map, then I would make sure you whole mini-map is set up using Unity's GUI system. That way you can do the coordinate math without changing from world space to screen space.

I would suggest taking an above-terrain screenshot, and using that as a GUI texture. Then you can script it to rotate as the character rotates and have it zoomed in. If you want, then you can use Paint or something else to add the nonmoving objects. Hope that helps.