- Home /
Make HUD to show object direction
Hey Unitarians,
So what I have is my player which is in the center of my camera view. There are enemies around the scene. I want it so that the camera can display arrows on the screen to show the general direction where those enemies are. I can instantiate and assign textures for every enemy in the scene, but the things I can't do are:
Hiding the guitexture when the enemy comes into view of the camera
Making the arrow texture point continuously at the enemy.
An image is shown to give an example. If you look near the bottom of the screen it shows a red arrow that is pointing to an enemy off-screen.
Any script would be preferred in C# but I can read Unityscript as well!
You guys are the best
Is your camera at a fixed angle in space or can it rotate?
GUITextures cannot be rotated. You can use GUI.DrawTexture() or you can use world objects either seen by another camera or parented to this camera.
Assu$$anonymous$$g you only have a single camera that can see enemies, then you can use renderer.isVisible to tell if an enemy is visible. There are more solutions in this answer:
http://answers.unity3d.com/questions/8003/how-can-i-know-if-a-gameobject-is-seen-by-a-partic.html