• 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 Kohlsman knob?

mskhan1991

Resource contributor
Messages
935
Country
pakistan
I tried animating a knob from 0-100 frames which rotates the knob, after unsuccessfully looking for the knob in default modeldef.xml, I tried the one provided by Zeiten (Thanks a lot for that modeldef.xml)

The problem is it's not working in sim.

I am using the following code which I don't have much knowledge about, just a few things;

Code:
   <PartInfo>
    <Name>MIP_Knob_Kohlsman</Name>
    <AnimLength>100</AnimLength>
    <Animation>
       <Parameter>
          <Code>
         50 (L:Kohlsman Knob co,enum) +
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
        <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>Baro Setting Use Mouse Wheel</TooltipText>
           <MouseFlags>WheelUp+WheelDown</MouseFlags>
        <CallbackCode>
            (M:Event) 'WheelDown' scmp 0 == 
                if{
                    (L:Kohlsman Knob co, enum) -- -50 max (>L:Kohlsman Knob co, enum)
                    (>K:KOHLSMAN_DEC) }
                    1 (>L:rotary_click,bool)
            (M:Event) 'WheelUp' scmp 0 == 
                if{
                    (L:Kohlsman Knob co, enum)) ++ 50 min (>L:Kohlsman Knob co, enum))
                    (>K:KOHLSMAN_INC) }
                    1 (>L:rotary_click,bool)
        </CallbackCode>
    </MouseRect>
   </PartInfo>
 
Also, how do these knobs work? I mean using mouse for changing their values? and how they interact with the gauges?
 
I have set up this knob so you can use the mousewheel to change it's value and the knob itself change the baro setting on the altitude readout.

Code:
<MouseFlags>WheelUp+WheelDown</MouseFlags>

This one tells the sim what kinds of mouse interaction you can use on the knob.
Adding RightSingle+LeftSingle would allow you to also use left and right mouse button to interact with the knob.

Code:
<MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown</MouseFlags>


If that would be the case you also need to change your code so the animation also interact with the inputs.

Code:
(M:Event) 'LeftSingle' scmp 0 ==
(M:Event) 'WheelDown' scmp 0 ==
or
if{
 
I am using 100 keyframes for a 360 degree rotation of the knob and using your code (Just downloaded and worked with the resource Virtual cockpit that you have made) but in the sim it doesn't show the "hand" pointer when I bring the mouse onto it and it doesn't work!
 
I see one error in this code now.
Sorry about that.

Old
Code:
(L:Kohlsman Knob co, enum)) ++ 50 min (>L:Kohlsman Knob co, enum))

New
Code:
(L:Kohlsman Knob co, enum) ++ 50 min (>L:Kohlsman Knob co, enum)
 
Since I don't particularly care what position the knob itself has at any given time, I script my control variable such that it will continuously rotate. To do that requires only two minor changes...

1. There's no need to use a bias value for the animation variable, since the entire range from 0 to 100 frames will be continuously repeatable. So just using this is sufficient:
Code:
        <Code>
           (L:Kohlsman Knob co,enum)
        </Code>

2. You can easily script the mouse sections control variable to endlessly cycle by using a modulo reset, which makes the up and down scripts appear like this:
Code:
(L:Kohlsman Knob co, enum) ++ 100 % (>L:Kohlsman Knob co, enum)
 
(L:Kohlsman Knob co, enum) -- 0 % (>L:Kohlsman Knob co, enum)
 
like this?

Code:
   <PartInfo>
    <Name>MFI_Knob_Kohlsman</Name>
    <AnimLength>100</AnimLength>
    <Animation>
       <Parameter>
          <Code>
         (L:Kohlsman Knob co,enum)
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
        <MouseRect>
        <Cursor>Hand</Cursor>
        <TooltipText>Baro Setting Use Mouse Wheel</TooltipText>
           <MouseFlags>WheelUp+WheelDown</MouseFlags>
        <CallbackCode>
            (M:Event) 'WheelDown' scmp 0 == 
                if{
                    (L:Kohlsman Knob co, enum) ++ 100 % (>L:Kohlsman Knob co, enum)
                    (>K:KOHLSMAN_DEC) }
                    1 (>L:rotary_click,bool)
            (M:Event) 'WheelUp' scmp 0 == 
                if{
                    (L:Kohlsman Knob co, enum) -- 0 % (>L:Kohlsman Knob co, enum)
                    (>K:KOHLSMAN_INC) }
                    1 (>L:rotary_click,bool)
        </CallbackCode>
    </MouseRect>
   </PartInfo>
 
Apparently I forgot using attachpoint tool with the new object. Works fine with the last code I posted
 
Now that when I checked, I see that when I reach the ends and keep moving the knob, the Kollsman disc goes out of sync with the altimeter but when I press B the altimeter returns back to correct position but the Kollsman stay out of sync! :(
 
Check if you have tagged the correct parts with the correct codes.

The code given to you in this tread is only for the knob to set the pressure.
Post the code you are using for the disk please.
 
Code:
   <PartInfo>
    <Name>MFI_DISC_Kohlsman</Name>
    <AnimLength>260</AnimLength>
    <Animation>
       <Parameter>
        <Code>
         (L:Kohlsman Knob co,enum) 133 +
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
   </PartInfo>
 
Well, that will not work since you want the disk to be controlled by the current baro setting.

You want to use A:KOHLSMAN SETTING HG, inHg.
Also, create some maths with the code so your disk and readout matches.
 
My animation is from 0-130

And I using values from 28.05 to 31.90 (inHG)

Code:
   <PartInfo>
    <Name>MFI_DISC_Kohlsman</Name>
    <AnimLength>130</AnimLength>
    <Animation>
       <Parameter>
        <Code>
         (A:KOHLSMAN SETTING HG, inHG) 0.0296 * 65 +
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
   </PartInfo>


The disc doesn't move with this code however......

0.0296 because (difference of 31.90-28.05) 3.85 /130= 0.0296

and 65+ for a standard setting of 29.92 inHG
 
Also tried this since each frame equals one millibar of movement:

Code:
   <PartInfo>
    <Name>MFI_DISC_Kohlsman</Name>
    <AnimLength>130</AnimLength>
    <Animation>
       <Parameter>
        <Code>
         (A:KOHLSMAN SETTING MB, millibars) 65 +
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
   </PartInfo>

Now it's stuck at the last frame :P
 
Still not working.... can you do me a favour

kindly let me know what will work with the following code. I mean what value on Kollsman disc should I start from that should be on kf 0 and what should be my last keyfram number and what value should that hold.

Code:
   <PartInfo>
    <Name>MFI_DISC_Kohlsman</Name>
    <AnimLength>130</AnimLength>
    <Animation>
       <Parameter>
        <Code>
         (A:KOHLSMAN SETTING MB, millibars)
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
   </PartInfo>

Here's an explaination of what I am using right now:

1.jpg
 
SOLUTION: I was experimenting whole day yesterday and today I succeeded, I realized the code does not mark datum as the reference but the value of 0.

So here is the code, quite simple :(

Code:
   <PartInfo>
    <Name>MFI_DISC_Kohlsman</Name>
    <AnimLength>130</AnimLength>
    <Animation>
       <Parameter>
        <Code>
         (A:KOHLSMAN SETTING MB, millibars) 950 -
        </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
   </PartInfo>

Offset is -950 because I want keyframe 0 to show a value of 950mbars and the keyfram 130 to show value of 1080mbars
 
Back
Top