• 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 ModelDef Animation; Mouse control

Messages
10,163
Country
us-arizona
Hey all,

Is this correct? I cannot get the knob to function. This is an altitude selector knob. The knob will not effect the numbers readout. The clicks occur, mouse hand works, but drag/click/wheel are not working the numbers.

Code:
<!-- learjet24_alt_adj_knob -->

  <PartInfo>
    <Name>learjet24_alt_adj_knob</Name>
       <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                     (L:LF24B SET ALT ADJUST KNOB,bool) 100 *
                </Code>
                <Lag>950</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
          <TooltipText>Altimeter Set Adjust</TooltipText>
            <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle+LeftDrag+WheelUp+WheelDown+RightSingle+RightDrag</MouseFlags>
      <CallbackCode>

        (M:Event) 'LeftSingle' scmi 0 ==
        (M:Event) 'WheelUp' scmi 0 == or
        (M:Event) 'LeftDrag' scmi 0 == or
                                         if{
                                         1 (>L:LF24B SET ALT ADJUST KNOB,bool)
                                         1 (>K:AP_ALT_VAR_INC)
                                         1 (&gt;L:XMLSND12,enum)
                                           }
        (M:Event) 'RightSingle' scmi 0 ==
        (M:Event) 'WheelDown' scmi 0 == or
        (M:Event) 'RightDrag' scmi 0 == or                                          
                                         if{
                                         1 (>L:LF24B SET ALT ADJUST KNOB,bool)
                                         1 (>K:AP_ALT_VAR_DEC)
                                         1 (&gt;L:XMLSND12,enum)
                                             }
      </CallbackCode>
        </MouseRect>
    </PartInfo>
 
Last edited:
If XMLSND is making a sound then we can assume that the basic logic is ok. Does your aircraft.cfg have AP altitude functionality in the Autopilot section?
 
Hey Anthony,

The 2D gauge part does work and can adjust fine. The knob object however does not.
 
Here is the code from the mouse section of the 2D gauge.

Code:
  <Area Top="20" Bottom="50" Left="60" Right="100">
    <Tooltip>Altitude Select Decrease</Tooltip>
    <Cursor Type="DownArrow"/>
    <Click Event="AP_ALT_VAR_DEC" Repeat="Yes"/>
  </Area>
  <Area Top="20" Bottom="50" Left="105" Right="140">
    <Tooltip>Altitude Select Increase</Tooltip>
    <Cursor Type="UpArrow"/>
    <Click Event="AP_ALT_VAR_INC" Repeat="Yes"/>
  </Area>
 
Is it important that the drag function operates?
If not I got a working code you can use.

Code:
      <PartInfo>
    <Name>MIP_AP_Altitude_Set</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:mip ap alt set, enum) 1 * flr</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_TARGET_ALTITUDE</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown+DownRepeat</MouseFlags>
      <CallbackCode>
        (L:mip ap alt set, enum) 0 &lt; if{ 100 (>L:mip ap alt set, enum) }
        (L:mip ap alt set, enum) 100 &gt; if{ 0 (>L:mip ap alt set, enum) }
        (M:Event) 'LeftSingle' scmi 0 == if{ (&gt;K:AP_ALT_VAR_DEC) 10 / 100 % (L:mip ap alt set, enum) -- 100 min (>L:mip ap alt set, enum) }
        1 (>L:XMLSND12,enum)
        (M:Event) 'RightSingle' scmi 0 == if{ (&gt;K:AP_ALT_VAR_INC) 10 / 100 % (L:mip ap alt set, enum) ++ 0 max (>L:mip ap alt set, enum) }
        1 (>L:XMLSND12,enum)
        (M:Event) 'WheelUp'     scmi 0 == if{ (&gt;K:AP_ALT_VAR_INC) 10 / 100 % (L:mip ap alt set, enum) ++ 0 max (>L:mip ap alt set, enum) }
        1 (>L:XMLSND12,enum)
        (M:Event) 'WheelDown'   scmi 0 == if{ (&gt;K:AP_ALT_VAR_DEC) 10 / 100 % (L:mip ap alt set, enum) -- 100 min (>L:mip ap alt set, enum) }
        1 (>L:XMLSND12,enum)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
Last edited:
Hey Daniel,

I'll check that out now.

No, its not important. Mouse wheel is the most important.

Many thanks.
 
Hi Bill ?..... Would you be so kind as to share the code for the Alt Alerter altitude drums ?

Skip
 
Skip,
We used 2D code. Its not 3D drums. Here is the code though.
I wonder, if you used a 3D drum and mapped it with a $pan gauge texture, compressed the texture a bit, wouldnt it 'appear' to be rotating? I could be wrong.

Code:
<!-- 10,000' -->
<Element>
  <Position X="0" Y="0"/>
  <MaskImage Name="altitude_alert_mask2.bmp">
    <Axis X="59" Y="26"/>
  </MaskImage>
  <Image Name="altimeter_alert_numbers_10000.bmp">
    <Nonlinearity>
      <Item Value="0" X="0" Y="0"/>
      <Item Value="9" X="0" Y="277"/>
    </Nonlinearity>
  </Image>
  <Shift>
    <Value>(A:AUTOPILOT ALTITUDE LOCK VAR,Feet) 0 max  s1 10000 / 10 % flr l1 10000 % 9999 &gt; if{ l1 10 % 9 - + }</Value>
  </Shift>
</Element>

<!-- 1,000' -->
<Element>
  <Position X="0" Y="0"/>
  <MaskImage Name="altitude_alert_mask2.bmp">
    <Axis X="82" Y="24"/>
  </MaskImage>
  <Image Name="altimeter_alert_numbers_1000.bmp">
    <Nonlinearity>
      <Item Value="0" X="0" Y="0"/>
      <Item Value="9" X="0" Y="277"/>
    </Nonlinearity>
  </Image>
  <Shift>
    <Value>(A:AUTOPILOT ALTITUDE LOCK VAR,Feet) 0 max  s1 1000 / 10 % flr l1 1000 % 999 &gt; if{ l1 10 % 9 - + }</Value>
  </Shift>
</Element>

<!-- 100' -->
<Element>
  <Position X="0" Y="0"/>
  <MaskImage Name="altitude_alert_mask2.bmp">
    <Axis X="108" Y="24"/>
  </MaskImage>
  <Image Name="altimeter_alert_numbers_1000.bmp">
    <Nonlinearity>
      <Item Value="0" X="0" Y="0"/>
      <Item Value="9" X="0" Y="277"/>
    </Nonlinearity>
  </Image>
  <Shift>
    <Value>(A:AUTOPILOT ALTITUDE LOCK VAR,Feet) 0 max  s1 100 / 10 % flr l1 100 % 99 &gt; if{ l1 10 % 9 - + }</Value>
  </Shift>
</Element>
 
Why on earth would you do that?
Just more work in my eyes, but yeah, it would probably work.

@Skip67

Can post some codes later today unless someone beats me to it.
 
I wonder, if you used a 3D drum and mapped it with a $pan gauge texture, compressed the texture a bit, wouldnt it 'appear' to be rotating? I could be wrong.
Of course it will, Bill. That is precisely what I was forced to do on the B737-200C project, because of the massive number of animations it required. So many in fact, that I "ran out of animation possibilities" entirely!

I reported this technique here over a year ago as well. What I wound up doing was to delete all but six polys of every drum, leaving a nicely curved surface to act as the projection screen for 2d gauges. Using the traditional number strips allowed the semi-drums to create the illusion of 'rotating' rather than being the static objects they truly were.

By adopting this technique, I not only reduced the polygon & t-vert count, I also eliminated 286 animations! :teacher:
 
Nice.......!

I firmly believe in using 2D gauges in the VC. Just makes sense to me, unless you need to really bad and it looks brilliant. So many things you can do with nice resolution bitmaps that float in code. Easier to modify too... :S
 
Back
Top