Widget altimeter speedometer

I’m trying to make a widget altimeter speedometer like that one on this video, but I don’t know how. Somebady can help me please?

This whole thing is not that simple. You need vector math to do it properly. Also a lot depends on if you using physics model for flying, or you are faking it without physics. For fake model you can cut some corners and make it simple. But physics and vector math looks like it is proper way of implementing it all.

For proper vector math model you need: camera up vector, camera forward vector.

  • multiply camera forward vector by [1,1,0] then normalize it. This way you get forward vector that is always in horizontal plane
  • project camera up vector on plane that is defined by that horizontal forward vector. You will get vector that defines amount of roll.
    Last step is calculating DOT product between camera up vector and that roll vector. Dot product result is COsine between 2 vectors. So from it make arccosinus, and you get angle.