I would like to display a map when the player presses the “M” key. I have a image which is the same size as my terrain and is made from it’s height map so it should correspond to position.
After I’ve brought up the map. I would like the player to be able to see a dot where the player currently is in the terrain. Any idea on how to achieve this?
Cheers
I’ve figured out how to display the map. I get the following now when the user presses “m”.
The next step is figuring out how to draw a point on the map.
Drawing a point is as simple as positioning another sprite on top of the map in the appropriate position.
However there is another alternative for maps. Consider using a top down camera set only to render map layers. Then everything auto updates its position and status.
Hi, thanks for the tip. I have implemented the following, which works. Though had to transform the map:
Code as follows:-
bool map = false;
float player_position_x;
float player_position_z;
GameObject player1;
public Texture texture_image;
public Texture point_image;
bool toggleMap()
{
if (map == false)
{
return(true);
} else
{
return(false);
}
}
void Update ()
{
player1 = GameObject.Find ("Main Camera");
player_position_x = player1.transform.position.x;
player_position_z = player1.transform.position.z;
if (Input.GetKeyDown (KeyCode.M))
{
map = toggleMap();
}
}
void OnGUI ()
{
if (map == true)
{
GUI.BeginGroup (new Rect (10, 10, 2000, 2000));
GUI.DrawTexture(new Rect (10, 10, 513,513),texture_image);
GUI.DrawTexture(new Rect ((player_position_x/4)+10, (player_position_z/4), 10,10),point_image);
GUI.EndGroup ();
}
else
{
}
}