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

FSXA Continuously rotating knobs

Messages
468
Country
ca-ontario
I currently have a knob that is giving me grief and nothing I have tried has solved the problem. I have similar knobs that perform flawlessly (e.g. radio tuning knobs) but this one is being stupid. Here's the scenario:

The knob is for a remote altitude selection head and it needs to rotate through 360° many times in order to select the target altitude on the device. In every instance we have tried the knob either (a) refuses to move at all, or, (b) rotates to the end of its animation and then scoots back to the start of the animation before rotating again.

I've tried multiple code formats, checked the scale and reset the part, built a new part in case that was the issue and still nothing fixes the problem.

I have posted the current version of the code below but be aware that it is tied in with a 2D logic gauge that is controlling other inter-related functions of the auto-pilot head and the annunciator display panel hence the complex looking code. Ignore the funky L:Var name too as that was done in a moment of deep frustration! :rolleyes:

Code:
<PartInfo>
    <Name>Mallard_ALT_sel_100's_knob</Name>
    <AnimLength>360</AnimLength>
    <Animation>
        <Parameter>
            <Code>
            (L:Mallard_ALT_stupid_knob,enum)
            </Code>
            <Lag>100</Lag>
        </Parameter>
    </Animation>
    <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>ALT_SELECT</TooltipText>
        <MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown+DownRepeat</MouseFlags>
            <CallbackCode>
            (M:Event) 'LeftSingle' scmi 0 == (M:Event) 'WheelUp' scmi 0 == || if{
            (L:Mallard_ALT_stupid_knob, enum) 14 - dnor (&gt;L:Mallard_ALT_stupid_knob, enum)
            (L:Mallard_ALT_sel_VAR, enum) 100 - -100 max (>L:Mallard_ALT_sel_VAR, enum)
            (L:Mallard_Alt_Mode, enum) 2 == if{ 18 (>L:Mallard_I_ADJ_ALT_VAR, enum) (L:Mallard_ALT_sel_VAR, enum) (&gt;K:AP_ALT_VAR_SET_ENGLISH) } }

            (M:Event) 'RightSingle' scmi 0 == (M:Event) 'WheelDown' scmi 0 == || if{
            (L:Mallard_ALT_stupid_knob, enum) 14 + dnor (&gt;L:Mallard_ALT_stupid_knob, enum)
            (L:Mallard_ALT_sel_VAR, enum) 100 + 35000 min (>L:Mallard_ALT_sel_VAR, enum)
            (L:Mallard_Alt_Mode, enum) 2 == if{ 18 (>L:Mallard_I_ADJ_ALT_VAR, enum) (L:Mallard_ALT_sel_VAR, enum) (&gt;K:AP_ALT_VAR_SET_ENGLISH) } }
            </CallbackCode>
    </MouseRect>
    </PartInfo>

Using the above code the mouse-over works perfectly (i.e. the selected altitude display changes as required) as does the rest of the system it's just the visible animation of the knob that is causing problems. It currently rotates then spins back instead of rotating for as long as either the mouse button is pressed or the mouse-wheel is rotated.

Any suggestions/solutions would be greatly appreciated as this is currently driving myself and Roman (Spokes2112) crazy as nothing we have tried has worked.
 
Taking modulo of the animation variable might work. It at least does for a continuous animation like a windscreen wiper.

Code:
<PartInfo>
<Name>Mallard_ALT_sel_100's_knob</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>
(L:Mallard_ALT_stupid_knob, enum) 360 % d
</Code>
<Lag>100</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>ALT_SELECT</TooltipText>
<MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown+DownRepeat</MouseFlags>
<CallbackCode>
(M:Event) 'LeftSingle' scmi 0 == (M:Event) 'WheelUp' scmi 0 == || if{
(L:Mallard_ALT_stupid_knob, enum) -- (&gt;L:Mallard_ALT_stupid_knob, enum)
(L:Mallard_ALT_sel_VAR, enum) 100 - -100 max (>L:Mallard_ALT_sel_VAR, enum)
(L:Mallard_Alt_Mode, enum) 2 == if{ 18 (>L:Mallard_I_ADJ_ALT_VAR, enum) (L:Mallard_ALT_sel_VAR, enum) (&gt;K:AP_ALT_VAR_SET_ENGLISH) } }

(M:Event) 'RightSingle' scmi 0 == (M:Event) 'WheelDown' scmi 0 == || if{ 
(L:Mallard_ALT_stupid_knob, enum) ++ (&gt;L:Mallard_ALT_stupid_knob, enum)
(L:Mallard_ALT_sel_VAR, enum) 100 + 35000 min (>L:Mallard_ALT_sel_VAR, enum)
(L:Mallard_Alt_Mode, enum) 2 == if{ 18 (>L:Mallard_I_ADJ_ALT_VAR, enum) (L:Mallard_ALT_sel_VAR, enum) (&gt;K:AP_ALT_VAR_SET_ENGLISH) } }
</CallbackCode>
</MouseRect>
</PartInfo>


Alternatively, use the crude method in the callback area.

Code:
<CallbackCode>
(M:Event) 'LeftSingle' scmi 0 == (M:Event) 'WheelUp' scmi 0 == || if{
(L:Mallard_ALT_stupid_knob, enum) -- (&gt;L:Mallard_ALT_stupid_knob, enum)
(L:Mallard_ALT_stupid_knob, enum) -1 ==
if{ 359 (&gt;L:Mallard_ALT_stupid_knob, enum) }
(L:Mallard_ALT_sel_VAR, enum) 100 - -100 max (>L:Mallard_ALT_sel_VAR, enum)
(L:Mallard_Alt_Mode, enum) 2 == if{ 18 (>L:Mallard_I_ADJ_ALT_VAR, enum) (L:Mallard_ALT_sel_VAR, enum) (&gt;K:AP_ALT_VAR_SET_ENGLISH) } }

(M:Event) 'RightSingle' scmi 0 == (M:Event) 'WheelDown' scmi 0 == || if{ 
(L:Mallard_ALT_stupid_knob, enum) ++ (&gt;L:Mallard_ALT_stupid_knob, enum)
(L:Mallard_ALT_stupid_knob, enum) 360 ==
if{ 0 (&gt;L:Mallard_ALT_stupid_knob, enum) }
(L:Mallard_ALT_sel_VAR, enum) 100 + 35000 min (>L:Mallard_ALT_sel_VAR, enum)
(L:Mallard_Alt_Mode, enum) 2 == if{ 18 (>L:Mallard_I_ADJ_ALT_VAR, enum) (L:Mallard_ALT_sel_VAR, enum) (&gt;K:AP_ALT_VAR_SET_ENGLISH) } }
</CallbackCode>
 
360 degree rotation and <Lag> should not be used together.

When you go from say 356 degrees to 5 degrees FSX will not go the short way (ie 356,357,358,359,0,1,2,3,4,5) but will go back through all the keyframes from 356 to 5.

You have three options:

1. Remove the lag command and put up with the lumpy animations.

2. Code your own lag command logic so it can deal with the 360 degree full rotation.

3. If you min and max values are fixed and known then you can keyframe multiple 360 degree rotations of the knob.
 
Thanks for the replies guys.

I tried your first suggestion Anthony and it worked (I was not aware of the 360° rotation and <Lag> issue). I'm not worried about the lumpy animation as it's only a small knob and is not directly in the pilot's face in flight.
 
Things you learn Larry.

I have a Garmin transponder that I need to figure out what to do with the knobs. It is the one with four knobs that you rotate to adjust the transponder code so there are eight positions the knobs can be in (0 to 7) so the animation is very lumpy. Of course the lag option (option 1) is out and I can't code multiple 360 degree rotations (option 3) as the user can just keep rotation the knobs infinitely so that only leaves making my own lag commands (option 2). I've been thinking about for a while now but someday I will have to figure out exactly what I will do.
 
Hmm ... not sure about the Garmin transponder but I have got a working BK KT76A transponder like this one:

p-KT76A-zoom.jpg


I used 8-sided drums for the digits and they are animated over 8 frames so the digits just jump from one to the next. The ident light also works (in a pseudo way) as I have two flat polys sitting just in front of the lamp that have individual visibility codes and each also has a timer to make it flash and each timer is different. The result is a lamp that flashes in a pseudo-random manner as if it is giving out idents based on calls from ground stations.
 
I just re-read your post Anthony and realised you meant the knobs and not the drums...doh! :banghead:

I've just checked mine and the knobs were animated over 8 frames too with each knob having 10° of rotation per frame so 80° of rotation over the full animation. It works quite well and doesn't look too jerky especially when you think the original knobs probably didn't turn very far for each change in digit.

I tagged both the drum and the knob with same code and the code for the 1000's knob/digit is shown below:

Code:
<PartInfo>
    <Name>Navion_Xpdr_1000s</Name>
    <AnimLength>8</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (A:TRANSPONDER1 CODE, BCO16) 12 >> 15 &amp;
        </Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <TooltipID>TOOLTIPTEXT_TRANSPONDER_ID</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>
      <CallbackCode>
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (>K:XPNDR_1000_INC) }
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (>K:XPNDR_1000_DEC) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (>K:XPNDR_1000_DEC) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (>K:XPNDR_1000_INC) }
        1 (>L:XMLSND1,bool)
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 
This is for a Kohlsman knob and it rotates endlessly
Code:
<Element>
      <Position X="16" Y="15"/>
      <Image Name="kohl_band.bmp" PointsTo="North">
         <Axis X="5" Y="14"/>
      </Image>
      <Rotate>
         <Value>(L:kn,number) (L:precision_kohlsman, millibars) 800 == (L:precision_kohlsman, millibars) 1050 == | if{ 0 (>L:kn,number) }</Value>
         <Nonlinearity>
            <Item Value="-40" X="7" Y="19"/>
            <Item Value="0" X="16" Y="3"/>
            <Item Value="40" X="25" Y="19"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="70"/>
      </Rotate>
   </Element>
 
Back
Top