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

P3D v2 Altimeter 3D and 2D difference

mskhan1991

Resource contributor
Messages
935
Country
pakistan
Although the picture is self explanatory, I'd still like to mention that difference occurs in barometric height shown by the Altimeter between 2d and 3d altimeters.

1.png


This is my first time designing a 2D gauge. I've attached the 2D gauge code plus the gauge itself. Please help me out as I am unable to understand this non linearity tables (I believe it has something to do with that).

Code:
<Gauge Name="Altimeter" Version="1.0">
   <Image Name="Altimeter_Background.bmp"/>
   <Element>
      <Position X="121" Y="70"/>
      <MaskImage Name="Altimeter_Strip_1_Mask.bmp">
         <Axis X="0" Y="7"/>
      </MaskImage>
      <Image Name="Altimeter_Strip_1.bmp">
         <Nonlinearity>
            <Item Value="28.1" X="0" Y="7"/>
            <Item Value="31.5" X="0" Y="347"/>
         </Nonlinearity>
      </Image>
      <Shift>
         <Value Minimum="28.1" Maximum="31.5">(A:Kohlsman setting hg,inHg)</Value>
      </Shift>
   </Element>
    
   <Element>
      <Position X="244" Y="290"/>
      <Image Name="Altimeter_Needle_10000.bmp">
         <Axis X="25" Y="215" PointsTo="North"/>
      </Image>
      <Rotate>
         <Value>(P:Units of measure, enum) 2 == if{ (A:Indicated Altitude, feet) } els{ (A:Indicated Altitude, meters) 5000 /</Value>
         <Failures>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>        
      </Rotate>
   </Element>
  
     <Element>
      <Position X="244" Y="290"/>
      <Image Name="Altimeter_Needle_1000.bmp">
         <Axis X="30" Y="125" PointsTo="North"/>
      </Image>
      <Rotate>
         <Value>(P:Units of measure, enum) 2 == if{ (A:Indicated Altitude, feet) } els{ (A:Indicated Altitude, meters) } 500 /</Value>
         <Failures>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
      </Rotate>
   </Element>
    
   <Element>
      <Position X="244" Y="290"/>
      <Image Name="Altimeter_Needle_100.bmp">
         <Axis X="15" Y="184" PointsTo="North"/>
      </Image>
      <Rotate>
         <Value>(P:Units of measure, enum) 2 == if{ (A:Indicated Altitude, feet) } els{ (A:Indicated Altitude, meters) } 50 / </Value>
         <Failures>
            <GAUGE_ALTIMETER Action="Freeze"/>
         </Failures>
      </Rotate>
   </Element>
  
     <Element>
      <Position X="429" Y="491"/>
      <Image Name="Altimeter_Knob.bmp">
         <Axis X="52" Y="52"/>
      </Image>
      <Rotate>
         <Value Minimum="28.1" Maximum="31.5">(A:Kohlsman setting hg,inHg)</Value>
         <Nonlinearity>
            <Item Value="28" Degrees="0"/>
            <Item Value="31" Degrees="720"/>
         </Nonlinearity>
      </Rotate>
   </Element>


   <Mouse>
      <Help ID="HELPID_GAUGE_ALTIMETER"/>
      <Tooltip ID="TOOLTIPTEXT_ALTIMETER_FEET" EnglishID="TOOLTIPTEXT_ALTIMETER_FEET" MetricID="TOOLTIPTEXT_ALTIMETER_FEET_METERS_SPECIAL"/>
      <Area Left="127" Right="153" Top="137" Bottom="161">
         <Help ID="HELPID_GAUGE_KOHLSMAN_KNOB"/>
         <Tooltip ID="TOOLTIPTEXT_ALTIMETER_KOHLSMAN_INHG" MetricID="TOOLTIPTEXT_ALTIMETER_KOHLSMAN_MBAR"/>
         <Area Right="14">
            <Cursor Type="DownArrow"/>
            <Click Event="KOHLSMAN_DEC" Repeat="Yes"/>
         </Area>
         <Area Left="14">
            <Cursor Type="UpArrow"/>
            <Click Event="KOHLSMAN_INC" Repeat="Yes"/>
         </Area>
      </Area>
   </Mouse>


</Gauge>
 

Attachments

Hi,

Yes, you need a Nonlinearity section for each needle.

For my Altimeter they look like this:

<Nonlinearity>
<Item Value="0" X="128" Y="55"/>
<Item Value="5" X="128" Y="197"/>
</Nonlinearity>

The background bitmap is 256 x 256; the needles' rotation point is at 128, 128.

What I do is load the background bitmap into a paint program, and put my mouse at the 0 line. This gives me the X and Y pixel location of my mouse. When I do that, it is 128, 55 (in this case the 128 is critical, the 55 not so much - is just has to be a low number). When I point to the 5 (at the bottom of the gauge) I get 128, 197. Plug those in using *your* bitmap values and hopefully your needles will be more accurate.

Sometimes I use more than just two points, to make the needles more accurate at intermediate values.

Hope this helps,
 
Hi,

Yes, you need a Nonlinearity section for each needle.

For my Altimeter they look like this:

<Nonlinearity>
<Item Value="0" X="128" Y="55"/>
<Item Value="5" X="128" Y="197"/>
</Nonlinearity>

The background bitmap is 256 x 256; the needles' rotation point is at 128, 128.

What I do is load the background bitmap into a paint program, and put my mouse at the 0 line. This gives me the X and Y pixel location of my mouse. When I do that, it is 128, 55 (in this case the 128 is critical, the 55 not so much - is just has to be a low number). When I point to the 5 (at the bottom of the gauge) I get 128, 197. Plug those in using *your* bitmap values and hopefully your needles will be more accurate.

Sometimes I use more than just two points, to make the needles more accurate at intermediate values.

Hope this helps,

Tried but failed miserably! :P

Couldn't understand how to do it. It would be really nice if you can just do it for a single one of my needles, especially the 100 one because that is the one creating problems a lot.
 
Need the background bitmap to do that! :)

It's attached in thread starter, namely Sarmad_altimeter.zip

Tried the non-linearity function again but it seems that the code I used does not like the non-linearity, my needle goes crazy with non-linearity.
 
Try more than two points in your nonlinearity table; much like keyframes for rotation animations. One at 0, 250, 500 and 750 feet could improve things.
It would, of course, be better to have a nonlinearity point every 100 or 200 feet.
 
Try more than two points in your nonlinearity table; much like keyframes for rotation animations. One at 0, 250, 500 and 750 feet could improve things.
It would, of course, be better to have a nonlinearity point every 100 or 200 feet.

Since my code is " (P:Units of measure, enum) 2 == if{ (A:Indicated Altitude, feet) } els{ (A:Indicated Altitude, meters) } 50 / "

What value should i choose for non-linearity table so I end up with a 100 feet?

For example: Value= "100 or (100/50=2)" for 100 feet?
 
Code:
<!-- ======================= Altimeter ===================== -->
    <!-- ======================= 10,000's Feet Needle =================== -->
    <Element>
        <Position X="95" Y="337"/>
        <Image Name="altimeter_10,000_needle.bmp">
            <Axis X="5" Y="6"/>
        </Image>
        <Rotate>
            <Value>(A:Indicated Altitude, feet)</Value>
            <Nonlinearity>
                <Item Value="0" X="94" Y="281"/>
                <Item Value="20000" X="148" Y="316"/>
                <Item Value="40000" X="126" Y="378"/>
                <Item Value="60000" X="62" Y="380"/>
                <Item Value="80000" X="39" Y="319"/>
            </Nonlinearity>
        </Rotate>
    </Element>
    <!-- ======================= 1000's Feet Needle ===================== -->
    <Element>
        <Position X="95" Y="337"/>
        <Image Name="altimeter_1000_needle.bmp" PointsTo="North">
            <Axis X="6" Y="32"/>
        </Image>
        <Rotate>
            <Value>(A:Indicated Altitude, feet) 10000 %</Value>
            <Nonlinearity>
                <Item Value="0" X="94" Y="281"/>
                <Item Value="2000" X="148" Y="316"/>
                <Item Value="4000" X="126" Y="378"/>
                <Item Value="6000" X="62" Y="380"/>
                <Item Value="8000" X="39" Y="319"/>
            </Nonlinearity>
        </Rotate>
    </Element>
    <!-- ======================= 100's Feet Needle ====================== -->
    <Element>
        <Position X="95" Y="337"/>
        <Image Name="altimeter_100_needle.bmp" PointsTo="North">
            <Axis X="4.5" Y="50"/>
        </Image>
        <Rotate>
            <Value>(A:Indicated Altitude, feet) 1000 %</Value>
            <Nonlinearity>
                <Item Value="0" X="94" Y="281"/>
                <Item Value="200" X="148" Y="316"/>
                <Item Value="400" X="126" Y="378"/>
                <Item Value="600" X="62" Y="380"/>
                <Item Value="800" X="39" Y="319"/>
            </Nonlinearity>
        </Rotate>
    </Element>

Here is an example. The x and y in the non-linearity are the coordinates of the relevant markings on the altimeter.
The % symbol is modulo. So
<Value>(A:Indicated Altitude, feet) 1000 %</Value> means that the value will be hundreds of feet or what is left after the thousands are removed from the altitude.
Since your altimeter is in feet you can forget metres and units of measure
Roy
 
Code:
<!-- ======================= Altimeter ===================== -->
    <!-- ======================= 10,000's Feet Needle =================== -->
    <Element>
   ...................................................
Since your altimeter is in feet you can forget metres and units of measure
Roy
[/QUOTE]

Thanks, got it. I now understand that the axis is the initial reference point according to which the sim looks at the Item value points and places the bitmap. And yes my scale coding needs a little work.
 
Back
Top