FSX G-Meter\Accelerometer animation

#1
Hi guys!
In my actual model I have a G-mete gauge. It has one normal pointer, which indicate g-force in real time, and two, each indicate lowest and highest value of G-force accepted during a flight. The last two can be resettable with a button.
My question is what type of code I must use for the last two pointers?
Thanks in advance!!!
 
#2
This is from my 'GM100' Student. For use in FS2004.
Code:
<Gauge Name="GM100 G Indicator" Version="1.0" Author="Edward Cook">
<!-- e-mail : tedcook@btinternet.com : This gauge is freeware.  -->
<!-- ImageSizes: Case=307,311: Scale=244,244: Ptrs= 13,150 -->

   <Image Name="g_case.bmp" />

   <Update>(L:GM100needleset,bool) 0 ==
      if{ 1 (>L:GM100gmin,Gforce) 1 (>L:GM100needleset,bool) }
   </Update>
      
   <Element>
      <Position X="153" Y="154" />
      <Image Name="g_ballistic_ptr.bmp">
         <Axis X="6" Y="106" />
      </Image>
      <Rotate>
         <Value>
            (A:G force,Gforce) s0 (L:GM100gmax,Gforce) &gt;
               if{ l0 (>L:GM100gmax,Gforce) }
            (L:GM100gmax,Gforce) 0.349 *
         </Value>
         <Delay DegreesPerSecond="180" />
      </Rotate>
   </Element>
   
   <Element>
      <Position X="153" Y="154" />
      <Image Name="g_ballistic_ptr.bmp">
         <Axis X="6" Y="106" />
      </Image>
      <Rotate>
         <Value>
            (A:G force,Gforce) s1 (L:GM100gmin,Gforce) &lt;
               if{ l1 (>L:GM100gmin,Gforce) }
            (L:GM100gmin,Gforce) 0.349 *
         </Value>
         <Delay DegreesPerSecond="180" />
      </Rotate>
   </Element>
   
   <Element>
      <Position X="153" Y="154" />
      <Image Name="g_ptr.bmp">
         <Axis X="6" Y="106" />
      </Image>
      <Rotate>
         <Value Minimum="-5" Maximum="12">
            (A:G force,Gforce) 0.349 *
         </Value>
         <Delay DegreesPerSecond="180" />
      </Rotate>
   </Element>

   <Mouse>
   
      <Area Left="0" width="307" Top="0" Height="240">
         <Tooltip>(%((A:G force,Gforce))%!2.1f! g.)</Tooltip>
         <Cursor Type ="Normal" />
      </Area>
      <Area Left="80" width="230" Top="241" Height="70">
         <Tooltip>(%((A:G force,Gforce))%!2.1f! g.)</Tooltip>
         <Cursor Type ="Normal" />
      </Area>
      <Area Left="0" width="70" Top="241" Height="70">
         <Tooltip>Reset</Tooltip>
         <Cursor Type ="Hand" />
         <Click>0 (>L:GM100gmin,Gforce) 1 (>L:GM100gmax,Gforce)</Click>
      </Area>
      
   </Mouse>

</Gauge>
NB; A:G space force' is the variable
but ',Gforce' ( with no space ) is the unit name.

Ted
 
#3
2d gauge or 3d ? Im pretty sure the 3d codes already in the modeldef.xml file for the mustang(maybe only there in the accel sdk)...but if not here is what Ive used in the past.....

Code:
<PartInfo>
   <Name>min_needle</Name>
   <AnimLength>160</AnimLength>
   <Animation>
     <Parameter>
       <Code>(A:MIN G FORCE, GForce) 10 * 40 + 0 max 160 min</Code>
       <Lag>100</Lag>
     </Parameter>
   </Animation>
 </PartInfo>

 <PartInfo>
   <Name>max_needle</Name>
   <AnimLength>160</AnimLength>
   <Animation>
     <Parameter>
       <Code>(A:MAX G FORCE, GForce) 10 * 40 + 0 max 160 min</Code>
       <Lag>100</Lag>
     </Parameter>
   </Animation>
 </PartInfo>

 <PartInfo>
   <Name>needle_G</Name>
   <AnimLength>160</AnimLength>
   <Animation>
     <Parameter>
       <Code>(A:G FORCE, GForce) 10 * 40 + 0 max 160 min</Code>
     </Parameter>
   </Animation>
 </PartInfo>

 <PartInfo>
   <Name>switch_G_reset</Name>
   <AnimLength>100</AnimLength>
   <Animation>
     <Parameter>
       <Code>(L:G_reset) (P:local time, seconds) &gt; if{ 100 } els{ 0 }</Code>
       <Lag>400</Lag>
     </Parameter>
   </Animation>
   <MouseRect>
     <Cursor>hand</Cursor>
     <HelpID>HELPID_EXTR_G_METER_RESET</HelpID>
     <CallbackCode>(>K:RESET_G_FORCE_INDICATOR) (P:local time, seconds) 0.5 + (>L:G_reset)</CallbackCode>
   </MouseRect>
 </PartInfo>
 
#4
Thank you

Thank you Ted, it's gonna be my next step )))
Thank you Au-MaV, you code it's what I need now )))
Thank you a lot, guys. Just like always FSDev - is the best flight forum whit huge friendly community!
 
#5
I've tried using this code and am struggling with the animation key framing for the needles. Using the same gauge face as using in Au-Mav's T-6 and assuming he used this code for that gauge. I set kf 0 at 1 g and then no matter how many frames I add the needle loads 180 degrees out of phase. It moves appropriately. any thoughts?
 
#5
Here are the MakeMDL parts I used in the Short SB4 Sherpa gauge.

Code:
<part>
    <name>sb4_g_reset</name>
    <animation>
        <parameter>
            <code>
                (L:Sb4_g_Button,bool) 50 *
            </code>
        </parameter>
        <lag>400</lag>
    </animation>
    
    <mouserect>
        <tooltip_text>Reset</tooltip_text>
        <cursor>Hand</cursor>
        <mouse_flags>LeftSingle+Leftrelease</mouse_flags>
        <callback_code>
         (M:Event) 'LeftSingle' scmp 0 ==
            if{ 0 (>L:SB4gmin,Gforce) 1 (>L:SB4gmax,Gforce) (L:Sb4_g_Button,bool) ! (>L:Sb4_g_Button,bool) }
         (M:Event) 'LeftRelease' scmp 0 ==
            if{ (L:Sb4_g_Button,bool) ! (>L:Sb4_g_Button,bool) }
        </callback_code>
    </mouserect>
</part>

<part>
    <name>sb4_g_min_pointer</name>
    <animation>
        <rotation>Y</rotation>
        <parameter>
            <code>
            (A:G force,Gforce) s1 (L:SB4gmin,Gforce) &lt;
               if{ l1 (>L:SB4gmin,Gforce) }
            (L:SB4gmin,Gforce) -0.349 *
            </code>
        </parameter>
    </animation>
</part>

<part>
  <name>sb4_g_pointer</name>
    <animation>
    <rotation>Y</rotation>
        <parameter>
            <sim>
                <variable>G FORCE</variable>
                <units>Gforce</units>
                <scale>-0.394</scale>
        <bias>0</bias>   
            </sim>
        </parameter>
    </animation>
    <mouserect>
        <tooltip_text>%((A:G force,Gforce))%!d!% g</tooltip_text>
    </mouserect>
</part>
    
<part>
    <name>sb4_g_max_pointer</name>
    <animation>
        <rotation>Y</rotation>
        <parameter>
            <code>
            (A:G force,Gforce) s0 (L:SB4gmax,Gforce) &gt;
               if{ l0 (>L:SB4gmax,Gforce) }
            (L:SB4gmax,Gforce) -0.349 *
            </code>
        </parameter>
    </animation>
</part>
whiteG.GIF
 
Top