FSX 3D attitude pitch and bank Gauges not working

#1
Hi folks;
I've tried every stock Attitude pitch and attitude bank animation
available and nothing is working so I tried these with no luck.
I've had results from no motion at all to disappearing needles.
So I'm wondering if it's a mistake in the code or if there is a bug in the
Variable.

HTML:
  <Animation name="needle_p51_attitude_pitch" guid="6A86CEBD-DD5C-4c6a-B3B8-1F9742352E5D" length="360" type="Sim" typeParam2="needle_p51_attitude_pitch" typeParam="AutoPlay" />
    
  <PartInfo>  
    <Name>needle_p51_attitude_pitch</Name> 
    <AnimLength>360</AnimLength>
    <Animation>  
      <Parameter>  
       <Sim>  
        <Variable>ATTITUDE INDICATOR PITCH DEGREES</Variable>  
        <Units>degree</Units> 
        <Bias>180</Bias> 
        <MinValue>-180</MinValue> 
        <MaxValue>180</MaxValue>             
       </Sim> 
       <Lag>26</Lag>
      </Parameter>  
    </Animation>  
  </PartInfo>


  <Animation name="needle_P51_attitude_bank" guid="84C15FE5-BE98-4552-AC18-1FFEDA600838" length="360" type="Sim" typeParam2="needle_P51_attitude_bank" typeParam="AutoPlay" />

  <PartInfo>  
    <Name>needle_P51_attitude_bank</Name> 
    <AnimLength>360</AnimLength>
    <Animation>  
    <Parameter>  
       <Sim>  
        <Variable>ATTITUDE INDICATOR BANK DEGREES</Variable>  
        <Units>degree</Units> 
        <Bias>180</Bias>
         <MinValue>-180</MinValue> 
        <MaxValue>180</MaxValue>             
       </Sim> 
       <Lag>40</Lag>
      </Parameter>  
    </Animation>  
  </PartInfo>
I'm happy to use these or the stock animations as long as the result is a working
attitude gauge.
Any suggestions are appreciated.
Thank you.
 

n4gix

Resource contributor
#2
I see nothing wrong with either of those, but I scripted my own custom XML for both pitch and bank. I'm animating a "ball" type ADI. Because of that, I limit pitch to +/- 90º because there's no need to see the "back of the ball..." :D

How did you animate your bank and pitch object(s)? Keep in mind that FSX requires "more keys" than FS9. In fact, I add many keys to pitch especially to properly "calibrate" it. :cool:

Code:
  <PartInfo>
    <Name>T38_needle_attitude_bank</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:ATTITUDE CAGE,bool) 1 &lt;
          if{ (A:ATTITUDE INDICATOR BANK DEGREES, degree) dnor }
          els{ 0 }
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_BACKUP_ATTITUDE_INDICATOR_BANK_PITCH</TooltipID>
    </MouseRect>
  </PartInfo>

  <PartInfo>
    <Name>T38_needle_attitude_pitch</Name>
    <AnimLength>180</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:ATTITUDE CAGE,bool) 1 &lt;
          if{ (A:ATTITUDE INDICATOR PITCH DEGREES, degree) 90 min -90 max 90 + }
          els{ 90 }
        </Code>
        <Lag>40</Lag>
      </Parameter>
    </Animation>
  </PartInfo>
 
#3
In the event that there was nothing wrong with with my code my next question was going to be about my animation. I did not use alot of keys so I will go back and work that out. I'll post the results.

Thank you.
 
#4
I'd be tempted to get rid of the min and max value lines as they aren't really needed plus the lag values aren't really needed either (and may, in fact, cause problems) as there is already a degree of lag in the stock variables which I think you can control to a degree in the aircraft.cfg file.

You should only key frames for each 90 deg of rotation.

Remember, when adding "bias" your attitude indicators will need to start in an extreme position (ie banked fully left) and will not be centred. They only become centred when the keyframe is 180.

For this reason I always add an extra 10 to any bias. It means all my parts are lined up at 0 animation frames and start their proper animations at 10 frames and onwards.

For example, with an aileron (with 200 frames animation) at 0 frames it is level at 10 it is fully down at 110 it is level again and at 210 it is fully up.

Having everything lined up at 0 frames helps to stop my brain from snapping.
 

n4gix

Resource contributor
#5
For example, with an aileron (with 200 frames animation) at 0 frames it is level at 10 it is fully down at 110 it is level again and at 210 it is fully up.

Having everything lined up at 0 frames helps to stop my brain from snapping.
I can see where that would be very useful in Max/GMax. In FS they will initialize at "fully level" anyway.

Nice tip! :cool:

For the pitch animation, I "calibrate" the ball to the painted index lines by adding additional keys for each 5º up/down for the first 30º, then every 10º up to max rotation, which in my case is +/- 90º...
 
#6
I can see where that would be very useful in Max/GMax. In FS they will initialize at "fully level" anyway.
It's bloody useful in FSDS I can tell you. I'm not sure how Max/Gmax handles animations but in FSDS you have to rotate the part into the position it needs to be at 0 frames which means that ailerons, rudders etc need to be at their extreme positions if you are using the standard XML animation scripts.

By using an offset I can keep everything nice and level and as you say, when the aircraft loads in FS they all level out anyway. FS never actually uses the 0 frame position.

One thing to watch out for is the animation lengths are wrong in some of the Standard animations.

For example, Rudder_percent_Key uses percent as the units, has an anim length of 100 and a bias of 50.

The problem is that rudder_deflection_pct (the variable that Rudder_Percent_key uses) returns values from -100 to 100 so Rudder_percent_key only shows half the rudder movement.

My version of rudder_percent_key uses percent as the units, has an anim length of 210 and a bias of 110.

This really had me scratching my head as the first time I tried an offset I kept wondering why my rudder animation was doing some odd things. It is only when I realised that some variables were returning values from -100 to 100 that I figured out the problem.
 

n4gix

Resource contributor
#7
It's bloody useful in FSDS I can tell you. I'm not sure how Max/Gmax handles animations but in FSDS you have to rotate the part into the position it needs to be at 0 frames which means that ailerons, rudders etc need to be at their extreme positions if you are using the standard XML animation scripts.
Anthony, Max/GMax has a "time slider" that allows one to "play" the animations back visually, among other things.

To keyframe a rudder for example, one would set the slider to mid point (frame 50), manually place a rotation key, then move the slider to frame 0.

Click on the Animate button (GMax) or the Auto Key button (Max), then Rotate the rudder to the left using the Local axis to it's full deflection. Unclick the button to "set the key" at frame 0. With the Angle Snap function enabled, one can achieve accurate and repeatable rotation angles.
 
#8
OK, Attitude and Bank animations are working perfectly now after adding keyframes.
I've animated the attiude calibration knob but could use some advice on the glide bar. The knob is animated from 0 to 360 so I've done the same with the glide bar starting frame 0 at the lowest setting and moving to the maximum height at frame 360. The obvious problem is that I need the bar to start at the center and move up and down accordingly. Is it possible to add a bias to the following script.
Code:
  <PartInfo>
    <Name>needle_p51_calibrate_attitude</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:P51 Attitude calibration, bool) 360 *</Code>
        <Lag>400</Lag>
      </Parameter>
    </Animation>
   </PartInfo>
Thanks again for the help.
 

n4gix

Resource contributor
#11
The "general formula" or prototype in normal notation is:

frames = ((sim variable) * scale) - bias

In XML syntax:

frames = bias (sim variable) scale * -
 

Roy Holmes

Resource contributor
#12
3D Ball ADI

A 3D ADI ball was fitted to the F-4 and A-7 aircraft. I flew both of them many years ago and recently I have modeled them in FS using FSDS. I used images from friends who have static panels from these aircraft to make an accurate representation of the actual ADI. The way I did this was to animate in the sequence, pitch then bank then heading using

attitude_indicator_backup_pitch, then attitude_indicator_backup_bank and finally needle_dg.

The tricky bit was the last. This part was a sphere divided into twelve 30 degree segments, each textured to show pitch and heading according to the center of the segment.

I used stock FSX modeldef animation as follows:
A frame that looks like the surround to the gauge as parent, with the following parts as children.
Next. A nominal part animated as attitude_indicator_backup_pitch,
Next. A nominal part animated as attitude_indicator_backup_bank,
Finally. A sphere divided into twelve 30 degree parts with textures that covered all 360 degrees of heading and up to plus/minus 60 degrees pitch plus two caps that covered the top and bottom 30 degrees. This was animated as needle_dg.

The resulting part shows the pitch, bank and heading against an adjustable needle_attitude_wings image which is the "W" shaped attitude reference in the ADI. This is adjustable in pitch by using Local pitch_trim variable, per modeldef.

In a normal turn the pitch and bank are indicated by the pitch texture and bank of the parts visible on the ball and in a loop maneuvre.

The ball shows "front" and "back" sides according to the up and down attitude of the aircraft. It looks just like I remember it was in the F-4 and A-7.

I did not need to create any new modeldef code. The stock code works.

Roy
 

n4gix

Resource contributor
#13
Roy, the "ball" for the T-38A main and standby ADIs are similar, but instead of moving the "W" reference point, these units offset the "balls" angular pitch.

Have you verified the calibration of your ADIs with Herve Sors's utility program AFSD?
 
Last edited:

Roy Holmes

Resource contributor
#14
3d adi

Bill,
You are correct, the pitch trim actually gives an adjustment to the ball of 10 degrees in dive and 5 degrees in climb against a fixed aircraft wings indicator. I chose to move the wings since it achieves the same thing. However I could have coded an increment or decrement to the pitch angle and made a new entry in modeldef that does the same as attitude_indicator_backup_pitch but using a L variable versus the A variable. I just used what was available in modeldef and the movable wing is an animated part needle_attitude_wings, controlled by knob_calibrate_attitude.

I did not calibrate it other than comparing the pitch displayed against a readout of pitch angle. The animation is smooth and appears to be accurate through a loop.

I had not heard of the tool you mention, but would be interested in getting it.
Thanks for the input.

Roy
 

n4gix

Resource contributor
#15
I just used what was available in modeldef and the movable wing is an animated part needle_attitude_wings, controlled by knob_calibrate_attitude.

I had not heard of the tool you mention, but would be interested in getting it.
Thanks for the input.

Roy
Roy, AFSD is available here: http://hsors.pagesperso-orange.fr/afsd.html

Although I created a custom L:var for the "pitch adjust" I could just as easily used the same sim variable (needle_attitude_wings) but applied it to a tiny hidden node which I created and animated.

My hierarchy is as below:
adi frame
...bank
......pitch adjust
...........pitch
...fixed wings
 

Roy Holmes

Resource contributor
#16
3D attitude

Bill,
Not familiar with the T-38 ADI and it looks like it does not display heading like the F-4 and A-7 did. I wanted to display pitch roll and heading in my model, the first two were easy in 2D or VC, the problem was heading. I think it would help if I attached two screen shots of the F-4 in a 20 degree bank left turn. Hope I managed to do that!

One shot shows the heading between 190 and 200, the other shows it about 150. There is some difference between that heading and the HSI below and it is because one is gyro and the other magnetic. Need to fix that.
You can see that the ball rotates in azimuth as well as bank and pitch and that was what I wanted to achieve. The aircraft wings are modelled as a wire that is adjusted by the knob to the right.

You might also be interested in the Machmeter which gives Mach and CAS using the same pointer. There is a fixed CAS scale and a rotating Mach scale like the real aircraft. The central pointer rotates according to CAS and the Mach scale rotates such that the pointer indicates both CAS and Mach. As altitude increases for a fixed CAS, the Mach scale rotates counter-clockwise showing an increase in Mach. Works up to 60,000 ft and Mach 2.2. Took me a while to calculate how to do that! XML code was easy once I worked out the math. I use Altova XMLSPY with a DTD I tailored to work with FSXA.

My standby ADI is also a ball but without heading and needs work.

The rest of the panel is based on photos from cockpit panel reconstruction friends who have helped a great deal. The panel is from an F-4M, the RAF version which I flew when I was young.

I set out to model all the aircraft I have flown, then added others I would like to have flown. Got about 20 at the moment including helicopters. They are all VC only and most of them are photorealistic including side consoles. I'm currently rebuilding everything because it has been a great learning experience and my first attempts put me to shame when I compare them with later attempts.

Thanks for the link and your help,

Roy
 

Attachments

n4gix

Resource contributor
#17
The T-38 has the same airspeed indicator, but I've not yet gotten the mach scale and kias pointer working properly.

Here's a WIP of the fwd cockpit "flying":


Uploaded with ImageShack.us

Here's a WIP of the both the fwd and aft cockpits on the ramp:

 

Roy Holmes

Resource contributor
#18
Airspeed and Mach indicator

Love your T38!

The gauge is set up with the airspeed scale as a mask for the mach scale with a central rotating needle on top. I am using Equivalent (calibrated) airspeed, not indicated, which is calculated as an L:var. <Value>(A:Ambient pressure,millibar) 1013.25 / sqrt (A:AIRSPEED mach,machs) * 661.48 * (&gt;L:AIRSPEED_EQUIVALENT,number)</Value>. I have found that IAS in FS has some errors and do not use it.

The needle rotates clockwise according to EAS and the non-linearity of the airspeed scale like any other airspeed gauge.

The airspeed and Mach scale non-linearities are such that at sea level they correspond. For example 0.8 M is at the same angle as 529 EAS relative to the needle, therefore the Mach scale does not rotate at sea level. As altitude increases the Mach scale rotates counter clockwise so that for a given EAS, Mach number increases. The amount of rotation needs to take into account where the needle has got to so that EAS and Mach are correct according to the needle.

I derived expressions for the non-linearity of both scales in terms of their rotation angle in degrees.

For the F-4 gauge;
Airspeed angle =(airspeed^-0.91)*(airspeed*950)-1400.3. I called this (L:AIRSPEED_ANGLE,number)
Mach angle= M^.006*24100-23798.4. I called this (L:AIRSPEED_MACH_ANGLE,number)

The inputs are equivalent airspeed as calculated above and Mach (A:AIRSPEED mach,machs)

The value of rotation of the Mach scale is:
<Value>(L:AIRSPEED_ANGLE,number) (L:AIRSPEED_MACH_ANGLE,number) - (&gt;L:AIRSPEED_MACH,number)</Value>

and it rotates according to its value in radians:
<Rotate>
<Value>(L:AIRSPEED_MACH,number) 0.01745329 *</Value>
</Rotate>

This way the counter clockwise rotation of the Mach scale is referenced off the rotational position of the airspeed needle as altitude increases. Below 200 knots EAS I put the value of rotation to zero.

Neither of the non-linearity expressions are exact but I biased them to give the best match around 0.9 Mach and 300 knots.
The scales were derived from images of the gauge.

Hope this helps
Roy
 

n4gix

Resource contributor
#19
Thanks for the additional information, Roy. I'm sure it will prove useful.

Your F-4 is looking nice as well! :D
 
#20
Hello Roy Holmes and n4gix. I realize this is an old post but I came upon it searching for an attitude indicator (ADI, FDAI, PFD, etc.) for FS9 or FSX that doesn't flip as I pass the 90° nose up or down position. Perhaps this isn't possible. The reason, requires a bit of background. The other day, I was downloading some panel and I saw the file for the Millennium Falcon (from Star Wars). I thought, cool to fly above 100000 ft as limited by FS9. When I did, I could see a dark sky with the stars. Further curiosity revealed that the constellations could be highlighted which led to research an accurate star layout - found it. With the MF, I found out I had control to about 400000 ft but none above that. As I flew around in the MF, it didn't really have much a panel; VC revealed the PFD and MFD. So I got curious in an ADI that worked without flipping. In my research, I came across a program called the Kerbal Space Program (KSP) and a program called Orbiter 2016. In these two programs, is an FDAI (from real space vehicles) or navball. The Apollo FDAI was a bit complicated but KSP's navball has three basic modes. 1) SURF(ace) - this acts as a regular attitude indicator. ORB(it) - this indicator is based on reference to a body's equator (Earth, or moon, etc.). The way this one works to my understanding is one as to think of being "inside" the navball. With the spacecraft pointed straight up, all blue hemisphere is shown. The longitudinal lines is the heading. Roll just pivots wherever the navball is at the moment (I'M not sure what the reference is when the roll(bank) is at 0°. When in orbit, the blue and orange hemispheres are split. The third mode is TARG(et). This is in reference to another object, such as the space station or other spacecraft. This wouldn't really apply to FSX, unless perhaps to refueling aircraft. There are "markers" to aid in controlling the position of the spacecraft, but again, I don't see a use for these. I've included an Apollo FDAI and KSP's navball for illustration. My question is: Can FSX (or even FS9) support such a gauge? If so, how? Thanks.
 

Attachments

Top