|
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
Edit -- How could I get game objects that do not move to show up accurately?
(comments are locked)
|
|
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. I am unfamiliar with rotating a GUI texture. Could you explain to me how that's done?
Aug 19 '10 at 02:04 AM
Peter G
Technically you can't rotate a GUI, but somebody found a way how to cheat. Here's two links for that: http://answers.unity3d.com/questions/3561/how-to-rotate-gui-textures http://answers.unity3d.com/questions/18209/individually-rotate-gui-elements
Aug 19 '10 at 10:56 PM
Mentalist4006
Actually, that's something different altogether. GUI textures are completely different than GUI methods and classes. They don't even have a common parent (GUI is in the top of the hierarchy of its class). GUI Textures require more manual coding, but are better for performance because they are drawn fewer times each frame. So, to clarify, you cannot rotate a GUI Texture.
Aug 20 '10 at 12:36 AM
Peter G
Edit, well I don't know what kind of internal base classes Unity has so they might share an ancestor somewhere, but the class reference doesn't show a common ancestor in any public apis. And I want to say good idea, and don't worry, it's a common mistake confusing the two. Here's the class reference. http://unity3d.com/support/documentation/ScriptReference/20_class_hierarchy.html
Aug 20 '10 at 02:39 AM
Peter G
Well, as the URL said, you could make multiple versions of the same texture, but rotate it so you get the rotating crosshair via scripting.
Aug 20 '10 at 11:08 PM
Mentalist4006
(comments are locked)
|
|
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. To take the screen shot, how would I remove displayed sound and lighting icons?
Aug 16 '10 at 07:27 PM
lampshade
I would look into http://unity3d.com/support/documentation/ScriptReference/Application.CaptureScreenshot.html that webpage. In the Unity editor create a top down view of your terrain and use a button press to grab the screen, you will likely need to crop it into a square in Photoshop or Gimp or whatever.
Aug 16 '10 at 10:49 PM
Peter G
Okay, I have the cropped image of the actual terrain mapped correctly (visable) onto a plane. A secondary camera is situated above the plane with the cropped texture. However, I don't understand how to place an indicator object "on top" as you describe it...Could you please be a little more specific?
Aug 17 '10 at 09:06 PM
lampshade
1 problem is that the secondary camera dissapears when I press play, what I think is that the main Camera (which follows the player) takes over. If I could get the map to stay up (which is within the secondary camera's FOV) while having the first camera follow the player, I could then proceed to the player indicator.
Aug 17 '10 at 10:21 PM
lampshade
The secondary camera is likely disappearing because the depth is being changed at runtime for either one of your cameras. By "place on top" I meant position an indicator mesh such as a sphere or plane above the terrain image plane. Actually though, the script will do that automatically so it is really just for visualization in the editor.
Aug 17 '10 at 10:50 PM
Peter G
(comments are locked)
|

Posted this here so you would get a blue envelope. I commented on my post.