- Home /
Icon (object) always faces camera, stays same size and can be seen through all other things. How to?
I want to make an icon (texture on plane) located somewhere in the scene that always faces the camera, alway stays the same size (close look and far away) and can be seen through all things in the scene.
Someone got an idea how to achieve this? If scripting is neccesary; I'm using JavaScript so please write in JavaScript so I'll understand.
Thanks!
Answer by DaveA · Jun 23, 2013 at 06:39 PM
Use a GUITexture and position it using WorldToScreenPoint
This should work, thanks. Can you give me an example on how to achieve this?
I would like to position the GUI texture on a place where I put for example a cube so I can easily position the GUI texture.
Answer by Eugenius · Jun 23, 2013 at 06:13 PM
Well, try creating your object, arrange it at the needed coordinates so your Camera can see it and in the Hierarchy tab make sure to make it a child of your Main Camera. Let me know if this helps :).
Also make sure to set up the rest of your scene slightly behind that object and it should work pretty good.
Sorry, it's not what I had in $$anonymous$$d. With facing the camera I ment a plane that rotates towards the camera (like the grass in the terrain editor). I also want the object to be seen through other objects, not by hiding the objects in front of it. Hope it's more clear now. Got any idea? Thanks for the help anyway!
Answer by alpaca of zion · Jun 23, 2013 at 06:49 PM
To do this I would make a second camera. Set that camera as a child of the main camera. Set the culling mask to only show the object you are interested in. Last, set the depth of the second camera higher than the depth of the first camera. Camera Documentation will be helpful.
Thanks, got it working for a part. Only thing left is I need the object (for example a cube) to stay the same size in the view, even when you're hundred meters away from it. Like it's part of the GUI, but then in 3D space. Got an idea?