Saturday, September 6, 2014

Cool Trick for Desk Maps in Unity Basic


Many of us Unity developers putting off buying Pro have lamented at the UI limitations of Unity 3D basic. Sure, sure, we've got an entire program just to make game development easy, but we want minimaps! Here's a cool way to use layers to create a static (desk) map that displays a portion your current larger play scene.
______________________________________________________________


The Concept
In Brune, players create cities made up of districts. Cool, how to represent that in 3D? Obviously 3D districts made up of terrain, lots, and buildings to go on the lots. 


Great! I've got a district with lots that build buildings when you click on them.

______________________________________________________________


 Now I Want:
  1. A map of the district players can look at
  2. The map has to show buildings the players just built by running around in the districts
Problem: Still don't want to buy Unity Pro so I don't have Render Texture to simply put  piece of paper on my Desk view that looks represents a current camera view of the district.

Solution: Put a giant desk below the district in question and have a camera look at it from above!
Like So

With and without ability to see other districts and the shared terrain

The final steps make sure players only see a lovely pseudo-mini-map and a candle-free terrain
  • Create 2 custom layers per district/desk setup. 
    • One for the district and all objects players will interact with outside of the map view
      • set all district objects to this layer
    • The other is for map view objects like the desk, candles, and paper
      • set all desk objects to this layer
  • Create a camera that looks at the desk as if you were sitting at it
    • Set it's occlusion culling to only the district and desk layers
      • make sure it CAN'T see the layers that the rest of your terrain/objects are on
______________________________________________________________


How to Use It
When you want a player to switch from first/third person view to viewing the desk, run a script that switches the active or topmost camera such that your desk is visible, and return to player cam when you're done!



______________________________________________________________

Fun fact: When I did this for my very first district, there was no over-terrain so the player could still run off the edge of the map into "Giant Desk Land"!
______________________________________________________________



All blog posts by UnityGirl are inspired by my work with Brunelleschi: Age of Architects on the Aesop Games team. Check out our Crowd Funding page(s)!

No comments:

Post a Comment