I took a look at the Mi-28 Havoc Altimeter as an example. The texture is wrong by the way, the 30 on the gauge should be a 40.

The gauge moves 45 degrees for every 20 meters of altitude all the way up to 100 meters. From 0 up to 100 meters is 5 x 45 = 225 degrees.

From 100 meters up to 300 meters the gauge moves 45 degrees for every 100 meters of altitude.

if (altitude < 100) angle = rad ((altitude/100)*225);
// altitude/100 is the percentage the gauge has moved of the first 100 meters, the fraction of 225 degrees the gauge has rotated.

else angle = rad(225 + (altitude - 100)*45/100);

// now we start new at 100 meters. The first 100m adds 225 degrees. Then Alt-100 gives us the alt that we've gone past 100m.
// divide it by 100 m to get the fraction of 100's and multiply by 45 degrees for every 100, and you get the degrees needed to rotate the needle.
// All the rad() function does is convert degrees to radians. The rotate function for the object wants radians.

Does that help at all?

Last edited by Javelin; 06/25/19 02:37 AM.