• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS Attitude Indicator Issues

Messages
45
I have converted my FSX/P3D project into MSFS and have most of the animations working. My one issue is with the attitude ball animation. I updated the xml I used within P3D to the newer MSFS one using the "Here's how to write you own ModelBehavior code." found within this site. Most of my other gauges are working pretty good except the attitude indicator. At first it was animated like the P3D one, 0-360 for both pitch and bank (values - 180/90/0/-90/-180 // -180/-90/0/90/180 set on frames 0-90-180-270-360). This works fine in P3D using the below code from modeldef.xml but when used in MSFS the bank goes all over the place with it sticking/stopping/going. Sometimes it will roll nicely until it reaches back to level, stops for a bit and then continues if you continue your roll.

XML:
<UseTemplate Name="ASOBO_GT_Anim_Code">
   <ANIM_NAME>attitude_indicator_bank</ANIM_NAME>
   <ANIM_CODE>(A:ATTITUDE CAGE,bool) 1 &lt; if{ (A:ATTITUDE INDICATOR BANK DEGREES, degree) 180 + } els{ 45 }</ANIM_CODE>
   <ANIM_LAG>0</ANIM_LAG>
   <ANIM_LENGTH>360</ANIM_LENGTH>
</UseTemplate>
<UseTemplate Name="ASOBO_GT_Anim_Code">
   <ANIM_NAME>attitude_indicator_pitch</ANIM_NAME>
   <ANIM_CODE>(A:ATTITUDE CAGE,bool) 1 &lt; if{ (A:ATTITUDE INDICATOR PITCH DEGREES, degree) } els{ 45 }</ANIM_CODE>
   <ANIM_LAG>0</ANIM_LAG>
   <ANIM_LENGTH>360</ANIM_LENGTH>
</UseTemplate>

Does anyone have an example of their attitude indicator they would like to share or help with this? Maybe my animation number in Blender are wrong.
 
Messages
244
Country
unitedkingdom
I agree there seems to be something very strange with the ATTITUDE INDICATOR vars. On my aircraft the BANK value seemed to work at first in a steady turn, but then the value wobbles in the direction of the turn and become meaningless.

The only guess I have is some error condition (insufficient power?) is kicking in.

My gauge is html/js and I changed from Simvar.GetSimVarValue("ATTITUDE INDICATOR BANK DEGREES", "degrees") to

let xyz = Simvar.GetGameVarValue("AIRCRAFT ORIENTATION", "XYZ")

( *var name from memory - typing this on a phone)

which then gives the required values as:

xyz.pitch, and
xyz.bank (radians)

With just that straight swap of the vars, my horizon gauge immediately worked perfectly, so there's something fishy with the other simvars.
 
Messages
244
Country
unitedkingdom
fyi I doubt you can use the orientation var in the XML, but you could write a 10-line html/js gauge that simply reads that orientation var and writes a couple of L: vars you could use instead in the XML.

Or maybe better, someone here knows the secret of the wobbly ATTITUDE INDICATOR vars.
 
Messages
2,077
Country
us-ohio
PLANE PITCH DEGREES and PLANE BANK DEGREES is what I've always used. Despite the name, they return as radians by default. You can, obviously, request it in degrees as you did for the ATTITUDE INDICATOR BANK DEGREES variable.
 
Messages
94
Can you check the animation keyframe interpolation setting? It should be on linear. I had a similar problem with an altimeter.
 
Messages
244
Country
unitedkingdom
for my MSFS html/js horizon gauge I can simply display the simvar value and watch it drift. I don't know if the OP has the same underlying issue but my testing confirmed 100% that the attitude vars are unreliable (where the AIRCRAFT ORIENTATION XYZ special var is rock solid). I have not used the attitude vars before so I don't know if they are unreliable by design, simulating some old-school gyro instrument failure?, which is what my drift looked like. E.g. an electricity or vacuum issue?
 
Last edited:

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
I would suggest using pitch before bank in your expression. The reason is that pitch goes from plus 90 to minus 90 and bank is continuous.
Roy
 
Messages
45
I would suggest using pitch before bank in your expression. The reason is that pitch goes from plus 90 to minus 90 and bank is continuous.
Roy
Not sure how to do that with xml code but should the parent object be pitch and the child bank? Right now I have the bank as the parent and the pitch child.

I'll try that later and see if that works better.
 
Messages
244
Country
unitedkingdom
I have the bank as the parent and the pitch child.
this seems correct to me, so the rolling motion axis does not move up and down and the pitch moves within the rolling motion. If the animations are parent-child in the model then the order in the <model>.xml is irrelevant (& Roy didn't have that info).

I know I'm repeating this (apologies, this is the last time) but are you sure your problem isn't something like the gyro electricity is actually off ?

Here's a debug suggestion: replace the bank ANIM CODE with this (which counts 0..90 every 10 seconds):

Code:
<ANIM_CODE>(E:ABSOLUTE TIME,seconds) 10 % 9 *</ANIM_CODE>

If the indicator behaves as expected (a linear bank rotation 0..90 degrees every 10 seconds, snapping back to 0) then your model & model.xml is OK and there's a problem with the simvar.
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
If you take an attitude indicator apart or just look at a diagram of what it does, you will see this;
The case is attached to the airplane. Inside the case is a gyro which tries to stay still as the airplane pitches and rolls. The gimbals for the gyro have arms that will move a pitch display up and down relative to it as the airplane pitches. Those arms are held by a rollable gimbal that rotates when the airplane rolls. So the gyro is the parent and it directly drives the pitch display. The display component of the pitch display can also roll according to bank so bank is the child.
Roy
 
Messages
244
Country
unitedkingdom
Roy I get the real instrument description but I think the extrapolation into sim programming is incorrect. Maybe it can be thought of as an 'inversion' that occurs when the sim code rotates the ball with reference to the airframe, rather than the aircraft rotating around the ball in a real aircraft. By a major coincidence I wrote an Attitude Indicator gauge earlier this week, with bank as the parent, and it's working like a charm.

ai_gauge.png
 
Top