- Home /
Translating main camera co-ords to minimap?
As the question states I'm trying to do the above and can't find a way to do it.
On the minimap I want a quadrilateral shape (I highly doubt it will be rectangular based on the angle of the camera) that shows the extents of what the camera can see in comparison to the rest of the world.
I've tried to use worldtoscreenpoint from my main camera to grab where the corners of the camera meet my terrain and then use the OnGUI function to draw the rectangle.
All in all I've been having no luck at all though. Attempting something along the lines of:
Vector 3 vect = Camera.main.WorldToScreenPoint(new Vector3(Screen.width, Screen.height,0));
Seems to return weird co-ordinates and then translating that to what I see on the minimap is becoming difficult (not the mention OnGUI won't work as it effects the entire screen and not the camera in question. Are there any resources out there that could help on this or does anyone have any ideas how I could try and implement this at all?