• 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.

Object "parenting" of Elements

Messages
137
Country
us-southcarolina
I have a 3D animation and special effects compositing background and tend to try to relate concepts in XML to functions in those other disciplines when possible for better comprehension of the concepts. I'm currently trying to "nest", "Link", "parent" an object element (the Child) that has it's own independent movement "inside" another object element (the parent) that has it's own independent movement. The desired result is once the "child" is positioned relative to the "parent", the "child" will inherit the motion of the "parent" in addition to it's own motion, but it's "anchor" or bounding 0,0 point would stay locked in the same relationship to the parent no matter what motion the parents does. Is this type of hierarchical relationship between object elements possible in an XML gauge ?

In 3D and 2D animation graphics this is a very simple process of set the 2 objects at the positional relationship desired, then link them declaring one the parent and one the child. Then the child can do any movement on it's own but will also inherit any movement of the parent maintaining that original positional relationship between them. So in affect all the x,y,z positional values of the child are automatically adjusted to include the movement of the parent to maintain that original positional relationship between them.

In my case I have a pitch ladder (my Parent) and a Heading Tape (my Child).
I have nested and aligned the child element in the parent element. Everything lines up and functions as desired as long as I maintain level flight with some minimal movement, but as soon as I bank, climb, or dive significantly the parent and child objects start to float apart but will come back together once level flight is re-established. The more drastic the movement or more G's the more it just goes to crap.

Below is a simplified version of the "nesting" and movement. What am I doing wrong ?

Code:
<Element>
    <Visible>(A:GEAR HANDLE POSITION,percent) 0 &gt;</Visible>
        <Element> 
            <Clip Top="100" Left="105" Right="570" Bottom="650"/>
            <Image Name="Pitch_Ladder_25_-25_GDown_00FF00.bmp" Bright="Yes" ImageSizes="272,1680">
                <Axis X="329" Y="820"/>
                </Image>
 //****** Heading Tape Nested******************
                    <Element>
                        <Position X="0" Y="-40"/>       
                        <Image Name="Heading_tape_340_140_00FF00.bmp" Bright="Yes" ImageSizes="1742,41">
                            </Image>
                        <Shift>
                            <Value>(A:Plane heading degrees gyro, degrees) dnor</Value>
                               <Nonlinearity>
                                    <Item Value="0" X="-233" Y="-40"/>  // X="98" Y="-40
                                    <Item Value="60" X="-857" Y="-40"/> // X="-526" Y="-40"
                                    <Item Value="120" X="-1481" Y="-40"/> // X="-1150" Y="-40"
                                </Nonlinearity>
                        </Shift>   
                    </Element>                                               
// END  of nested Heading tape ***********
            <Shift>
                <Value>(L:ClimbAngle, radians)</Value>
                    <Nonlinearity>
                        <Item Value="-1.570795" Y="2747"/>
                        <Item Value="1.570795" Y="-2747"/>
                    </Nonlinearity>
            </Shift>
            <Rotate>
                <Value>(A:PLANE BANK DEGREES,radians)</Value>
            </Rotate>
            <Shift>
                <Value>(A:VELOCITY BODY Y, m/s) (A:VELOCITY BODY Z, m/s) atg2 rddg /-/</Value>
                    <Nonlinearity>
                         <Item Value="0" Y="287"/>
                        <Item Value="90" Y="3034"/>
                    </Nonlinearity>
            </Shift>           
            <Shift>
                 <Value>(A:VELOCITY BODY X, m/s) (A:VELOCITY BODY Z, m/s) atg2 rddg /-/</Value>
                   <Nonlinearity>
                     <Item Value="-90" X="3077"/>
                     <Item Value="90" X="-2417"/>
                   </Nonlinearity>
            </Shift>                       
    </Element>

first, is it possible the setup the Parent/child relationship I described, and if so what is the std procedure for setting that relationship ? BTW in this example i have just included 1 of the 3 heading tape bitmaps and 1 of the 5 ladder bmp's but this ladder map is the one i want to "connect" to.

I tried using just a static BMP as a child but it too will start to "float" away from the parent when the parent moves much.

Thanks

Joel
 
I've never heard of this, although I don't actually know. You could simulate this by moving the child part using the same code as the parent part, then adding extra code to simulate its independent movement.
 
I've never heard of this, although I don't actually know. You could simulate this by moving the child part using the same code as the parent part, then adding extra code to simulate its independent movement.

There is a measure of inheritance going on. The child heading tape is originally aligned with the zero pitch horzion line of the parent pitch ladder. The child is rotated by the parent and it does stay parallel to the zero pitch line when it rotates so. but it starts to "Float" off the zero pitch line when pitching is employed. So it just won't stay fixed on the zero pitch line of the ladder.

So by nesting the child element in the parent element is that not doing the same thing as applying the same movement code of the parent since the child is in affect part of the parent object ?

Joel
 
If you were to create a pitch ladder and heading tape as textures then apply them to physical objects that are animated and linked then you can achieve the results you want. That would be a 3d gauge. I can't help with 2d, I'm not that well schooled for that kind of coding.
 
I was never able to get nesting to work. Same results as you.. Straight & level was OK.
I guess one could think of it this way - "For each .bmp it must be in it's own element".
There's nothing wrong with making each element follow the movement of a "parent" but providing additional movement.


Code:
    <Element Name="PITCH ROLL">
        <Position X="0" Y="0"/>
        <MaskImage Name="ATT_NUMBER_MAIN_MASK.bmp">
            <Axis X="145" Y="136"/>
        </MaskImage>
        <Image Name="ATT_NUMBER_MAIN.bmp" Luminous="0">
            <Axis X="107" Y="255"/>
        </Image>
        <Shift>
            <Value Minimum="-80" Maximum="80">(A:Attitude indicator pitch degrees:1,degrees) /-/</Value>
            <Scale Y="2.15"/>
            <Delay PixelsPerSecond="60"/>
            <Failures>
                <SYSTEM_ELECTRICAL_AVIONICS Action="-20"/>
                <GAUGE_ATTITUDE Action="-20"/>
            </Failures>
        </Shift>
        <Rotate>
            <Value>(A:Attitude indicator bank degrees:1,radians)</Value>
            <Delay DegreesPerSecond="90"/>
            <Failures>
                <SYSTEM_ELECTRICAL_AVIONICS Action="-20"/>
                <GAUGE_ATTITUDE Action="-20"/>
            </Failures>
        </Rotate>
    </Element>


    <Element Name="HEADING">
        <MaskImage Name="ATT_HDG_MASK.bmp">
            <Axis X="145" Y="136"/>
        </MaskImage>
        <Image Name="ATT_HDG.bmp" Luminous="0" Bilinear="1">
            <Axis X="1000" Y="21"/>
        </Image>
        <Shift>
            <Value Minimum="-80" Maximum="80">(A:Attitude indicator pitch degrees:1,degrees) /-/</Value>
            <Scale Y="2.15"/>
            <Delay PixelsPerSecond="60"/>
            <Failures>
                <SYSTEM_ELECTRICAL_AVIONICS Action="-20"/>
                <GAUGE_ATTITUDE Action="-20"/>
            </Failures>
        </Shift>
        <Shift>
            <Value Minimum="-1440" Maximum="1440">180 360 (A:HEADING INDICATOR 1, degrees) dnor s1 rng if{ l1 360 - /-/ 4 * } els{ l1 /-/ 4 * }</Value>
            <Scale X="1"/>
            <Delay PixelsPerSecond="1000"/>
            <Failures>
                <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
            </Failures>
        </Shift>
        <Rotate>
            <Value>(A:Attitude indicator bank degrees,radians)</Value>
            <Delay DegreesPerSecond="90"/>
            <Failures>
                <SYSTEM_ELECTRICAL_AVIONICS Action="-20"/>
                <GAUGE_ATTITUDE Action="-20"/>
            </Failures>
        </Rotate>
    </Element>
 
Joel,
Heading is where the airplane is pointing, so it should be displayed relative to a fixed axis/point on the HUD or HMD. You read heading looking at the display so it should not be rotated by bank. The position of the heading scale might move up or down depending on where it is compared to the focus of attention on the display.
For example in cruise flight with low Angle of Attack (AOA) the focus of attention is usually at the middle of the display so the heading should be there or above the middle.
On the approach AOA is greater and the focus of attention moves down, therefore there is a case for moving the heading scale down as well. But it would be a Phase of Flight thing not a dynamic movement.
Don't nest the heading scale.

The pitch scale is also read off a fixed symbol, where the airplane is pointing in the vertical plane, so it can be a child, but of a fixed parent.

If you look at a modern fighter airplane on the approach, it can be descending on a 3 degree slope with its nose 9 degrees up because it has a 12 degree AOA. In this case the focus of attention is the velocity vector (VV) which should be on the runway and just above the nose. The VV is where the airplane is going and it is displayed relative to the airplane longitudinal axis, like the heading and pitch scales.

Some advanced displays do display flight path angle relative to the velocity vector and they have an arguable case for nesting. But not heading or pitch.

So, why are you nesting things that should be displayed relative to fixed points.
Roy
 
Joel,
So, why are you nesting things that should be displayed relative to fixed points.
Roy

Roy,
This project is a HUD that will eventually be "generic'' in that I can use it in any of my aircraft with minimal alteration. I have done a lot of research on different HUDs and their features. The heading tape incorporated with the zero pitch line is a feature I've seen in many HUDs, mainly commercial Jets , ERJ's, 737, 400m, and Rockwell Collins HGS system.
HUD Samples2.jpg

In my HUD this feature is selective and mainly for use during approach. Currently it is activated with "gear down", but I plan to either tie it to a switch or have it as an option in an aircraft specific gauge ini file. I agree with you about area focus during different phases of flight. Usually I have the tape fixed at approx the bottom of the upper 3rd but sometimes find it annoying when the zero pitch line and or the VV keep passing thru it and during approach it's too high (ie above my preferred area of focus). I thought that tying it to the zero pitch line seemed a lot cleaner, less cluttered, and gets it down in to the upper part of my focus during approaches. And with the addition of a heading bug it seems a compact way to get more info in a focused area without adding too much clutter. At least that's my thought.

Given my background the intuitive way to achieve this is to nest or tie one function (ie the heading tape function, my child) to the another (ie the zero pitch line of the ladder, my parent). I have the pitch ladder conformal so at low alt and during approaches it stays locked to the sim horz. And i have my heading tape nested in the ladder element and aligned with the zero pitch line of the ladder. At close to level flight it works as desired and while it does rotate with the zero pitch line it starts to float off the line when banking more than a few deg. So I'm assuming that while the rotation is being inherited, the x,y positioning is not, at least not fully. I think I'm going to try Roman's approach and keep all the pieces(children) in the same parent Element and apply the same parental movement to the children separately. thoughts?

Joel
 
Last edited:
I was never able to get nesting to work. Same results as you.. Straight & level was OK.
I guess one could think of it this way - "For each .bmp it must be in it's own element".
There's nothing wrong with making each element follow the movement of a "parent" but providing additional movement.

Roman,
I'm going to try this but have a couple of questions....

In your example I only saw one position reference. One for the "Pitch Roll" element but none for the "heading" Element

Code:
    <Element Name="PITCH ROLL">
        <Position X="0" Y="0"/>

Is a position not required for the second Element "Heading" or does it take on the position of the first Element ?

In my research i have seen examples of code where several image Elements are nested in a parent and the Shift and Rotate are only applied once and it is inherited by all the image elements. If that works would your code work if written like this...(taking out the "failures" refs)

Code:
<Element>
    <Element Name="PITCH ROLL">
        <Position X="0" Y="0"/>
        <MaskImage Name="ATT_NUMBER_MAIN_MASK.bmp">
            <Axis X="145" Y="136"/>
        </MaskImage>
        <Image Name="ATT_NUMBER_MAIN.bmp" Luminous="0">
            <Axis X="107" Y="255"/>
        </Image>
    </Element>
    <Element Name="HEADING">
        <MaskImage Name="ATT_HDG_MASK.bmp">
            <Axis X="145" Y="136"/>
        </MaskImage>
        <Image Name="ATT_HDG.bmp" Luminous="0" Bilinear="1">
            <Axis X="1000" Y="21"/>
        </Image>
        <Shift>
            <Value Minimum="-1440" Maximum="1440">180 360 (A:HEADING INDICATOR 1, degrees) dnor s1 rng if{ l1 360 - /-/ 4 * } els{ l1 /-/ 4 * }</Value>
            <Scale X="1"/>
            <Delay PixelsPerSecond="1000"/>
        </Shift>
    </Element>
   <Shift>
       <Value Minimum="-80" Maximum="80">(A:Attitude indicator pitch degrees:1,degrees) /-/</Value>
       <Scale Y="2.15"/>
       <Delay PixelsPerSecond="60"/>
   </Shift>
   <Rotate>
       <Value>(A:Attitude indicator bank degrees:1,radians)</Value>
       <Delay DegreesPerSecond="90"/>
   </Rotate>
</Element>

Would this work ?

thanks for your help I'm going to try applying my desired "parental" movement to the heading tape directly and see what happens.

Joel
 
Last edited:
Joel,

Since you did the work to combine the 2 elements I threw it into the ADI code and gave it a shot. Doesn't work, it gives the same results - OK when absolutely level, all screwed up at any other pitch/roll. Logically it seems like it should work, but doesn't. It almost seems like it's "Additive" - moves both elements at the pitch/roll then reapplies the pitch/roll to just the top element only summing the 2 applications of pitch/roll. This project was 4 years ago and if IIRC went through hours and hours before resorting to isolating each element.

BTW the <Position> of the first element was zero, zero. If <Position> is left out it assumes zero, zero. Sometimes I forget to take it out (no harm, no foul), as many of the <Elements> I create are from pre-made templates that include just about everything and most of it is not needed.
 
Joel,

Since you did the work to combine the 2 elements I threw it into the ADI code and gave it a shot.

Roman
thanks for giving it a whirl. Go figure on why it doesn't work. There is not a lot of documentation out there and I did find in the FS9 XML tuts examples of nesting for visibility, and the example i mentioned of nested image elements with a single rotate/shift applied. I guess it goes arye when you add in shift on a nest element. "Additive" as good an explanation as I can come up with and it does "look" a lot like that.

I'm going to give the individual approach a shot.

thanks
Joel
 
Back
Top