- Home /
Too subjective and argumentative
Draw "Blip" on Minimap?
I'm looking at changing my minimap implementation because I don't like it at all, I'm probably going to move to a static image as our maps are not big enough to warrant a rendertexture or anything like that. The only thing I can't quite work out is, what would be the best way to draw unit locations over the top of that. I figured I'd simply take the world co-ordinates of the objects, translate them to the correct position relative to the image (should be some fairly basic math for that) but how then could I go about implementing them on the screen? Would it be a case of me having to get the screen position of the actual minimap and then drawing them relative to that position through on OnGUI call? Or is there a better way to do this?
Sorry, but your question is not suitable for Unity Answers. Please use the Unity Forum for discussions such as "How to ...". Unity Answers is here to help you solve any specific problems you have.
Answer by robertbu · Apr 26, 2013 at 05:17 PM
Here is an alternate solution. Create a plane that exactly overlays the terrain that you are mapping. Place your map texture on the plane. Create a second, orthographic camera that displays this plane (i.e. only the second camera would display the plane, and the second camera's depth would be higher than the primary camera). Use the Viewport Rect to embed this camera in the main scene. To display the dot, just create a small plane with a dot that has the same coordinates as the player (child) and that is only visible to the second camera.
If you want to use the same camera, you have multiple different methods to display the map...GUI.DrawTexture, Graphics.DrawTexture, GUITexture, A plane in world space that tracks the camera..., but for all of these you will have to do some form of the conversion you indicate in your question.
Follow this Question
Related Questions
Objects on minimap replaced with icon? 1 Answer
Assigning UV Map to model at runtime 0 Answers
Displaying Objective Points Through GUI. 2 Answers
Get Terrain Texture 0 Answers