Creating a FlightSim Like GUI HUD for Showing the player the angle of the Camera.

So I’m creating a game where the player is blind and has sonar like vision. What I’m trying to do is to create a GUI system that will indicate the angle the player is looking at to indicate the player if he’s looking up or down while blind. At the moment I have a place holder which is simply a GUI label displaying the Euler Angle of the main camera. But what I want to do is to have a flight-sim like projected HUD like in the attached photo. Is there an example project anywhere? or anybody know how to I go about this. 19894-acombat44.jpg

I would be reluctant to use eulerAngles for rotating an indicator. There are multiple euler angles for any physical rotation, and Unity can change the representation as the object rotates. If you are just talking about the horizon lines, here is one simple solution:

  • Create a Quad that has a texture representing your horizon lines
  • Put the Quad just in front of the near clip plane of the camera. Assuming you are using a Perspective camera, that means you will need to scale the Quad way down to fit in the screen.
  • Make the Quad a child of the camera.
  • Add the following, simple script.

#pragma strict
function LateUpdate() {
	transform.rotation = Quaternion.identity;
	transform.rotation = Quaternion.LookRotation(transform.parent.forward);

Note you will get the best behavior if the Quad is anchored at the center of the camera. That means if you want the indicator to be above or below the center, you’ll have to oversize the texture and move the indicator above/below the center of the texture.