- Home /
Creating overlays over the world environment
Hello everyone, i'm looking for a guidance, on how to create overlays over the existing environment (This is an example: http://videogamewriters.com/wp-content/uploads/2012/09/2KGMKT_XCOMEU_SCREENS_PCUI_Move_02.jpg ) I understand, that you can use mesh for the cursor (already doing this), but for the other stuff (shields on walls, or overlay on the floor), how do you do this kind of stuff?
No code needed, just high-level guidance.
Answer by Cherno · Aug 21, 2014 at 01:24 PM
You can easily get teh shields if you take every tile that is inside the movement radius, check if it's neighbors provide cover, and instantiate the corresponding shield mesh at the position.
Thanks, Cherno, that is what i thought:) And the ьщмуьуте radius? Should i calculate it and simply render a line through the points?
You would have to use some kind of pathfinding for that I suppose. Basically, you would take the maximum move radius, then iterate through all tiles (xz positions) around the soldier, and check if they can be reached by calling a path from your pathfinding solution. for every waypoint of each path, you check check for a penality based on the terrain (moving over cover might cost two tiles, for example). All tiles inside the effective move radius, meaning all that don't have a too high penalty, get highlighted however you want. The path selected by the mouse cursor is simply another pathfinding call where you use a LineRenderer to draw a line from waypoint to waypoint.
Answer by Alessio89 · Aug 21, 2014 at 12:20 PM
You should try the new 4.6 beta version of unity. It's out now and it contains the new GUI system that will be included in Unity 5. With this new system you can easily achieve that. Have a look here: Unity 4.6 - New UI System Overview
Thanks, Alessio89 i thought this kind of stuff is done with projectors or meshes. (Since it would be more expensive to calculate the correct angle and size of gui elements than, for example just to put a cubic mesh at required location). Or am i getting something wrong?
I'm pretty sure that getting satisfactory results by twisting and turning GUI elements is harder than hard. $$anonymous$$uch easier to just use actual objects inside the virtual space.
Your answer
![](https://koobas.hobune.stream/wayback/20220613160000im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to create an agenda or timetable system? 1 Answer
GUI.Label positioning for many device resolutions 1 Answer
Camera in Interface 1 Answer
Need help: Instantiating prefab or use GUITexture? Or any alternative? 0 Answers
Flash inside Unity 3 Answers