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

FSX FSX XML help

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
For a knob, this will give only one "rotation" for the entire range. Multiply by 10 if you wish the knob to rotate faster:

<Code>(A:NAV2 Radial,degrees) 10 *</Code>
 
Messages
1,749
Country
unitedstates
All of my 3d panel parts are working great!

Can Bill or someone show me how to write a bias so I can make the animation clicks larger and continous...Of course with no bias works great and the parts turn continous.
This is for 360 degree knobs. Some knobs turn 10 times every 360 degrees. So if you use low frames, you get no smooth transitions. So i want a bias that devides the animation with out
losing my continous turning.

_________________________________________________________________

yesterday I figured out how to create a 4 way switch and have it start at the far left position with a bias...Normally I can make a 4 way switch with the starting position in the middle! Here is what I did.....

60 animations on xml part......frames 0 to 60 on every 10 frames.

The bias is 10 / 30 +

Then set your scmp range ............. -- 0 max....++ 3 max

Works like a charm......i am getting better with bias formulas.

DG:eek:
 
Last edited:

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Bias is used only to offset the scaled variable to synch with the keyframe scale...

For example, suppose you have a variable with a range of -100 to +100 for it's output.

Obviously, we can't have "negative keyframes" (well, Max/GMax will create them, but FS can't use them!), so we need a way to "offset" or "bias" the variable to synch with our keyframes!

So, we create in Max/GMax an animation with 200 frames, with 100 being the "center".

If keyframe 100 = variable value of 0, then our bias must be 100!

Standard formula for this is:
Code:
frame = variable * scalar + bias
Since we don't need a scalar here, we can simplify the formula to:
Code:
frame = variable + bias

frame            variable + bias    
-------------------------------
0                  -100 + 100
100                   0 + 100
200                +100 + 100

Now, suppose instead we have a variable with a range of -50 to +50. We want to keep our keyframe range of 0 - 200 frames, so we now need to add a scalar to inflate the output to match our frame range. The scaler of course must be 2!

So, the formula again is:
Code:
frame = variable * scalar + bias

frame = variable * 2 + 100

frame            variable * 2 + bias    
------------------------------------
0                  -50 * 2 + 100
100                 0  * 2 + 100
200                +50 * 2 + 100

Hopefully these examples will help "cement" the purpose of "scalar" and "bias" for you!
 
Last edited:
Messages
1,749
Country
unitedstates
<Code>(A:NAV2 Radial,degrees) 10 *</Code>

For some reason I did try just using variable and it would stop at the end.
Or it would rewind funny. So maybe the amount of frames was my mistake.

For a work around and avoid snappy knobs I used 20 frames and no bias..
So I will just use this. But i do want to under stand what I did wrong.
I simply used 100 frames and a bias of:

<Code>(L:HUNADF, enum) 10 *</Code> and <Code>(L:HUNADF, enum) 10 * 50 +</Code>

Heres my code working code with 20 frames:

Code:
  <PartInfo>
    <Name>ADF_A</Name>
    <AnimLength>20</AnimLength>
    <Animation>
      <Parameter>
          <Code>(L:HUNADF, enum)</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
    <TooltipText>ADF 100</TooltipText>
      <MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown+DownRepeat</MouseFlags>
      <CallbackCode>
      (M:Event) 'LeftSingle' scmp 0 ==
      if{ (L:HUNADF, enum) -- 0 max (>L:HUNADF, enum) (>K:ADF_100_DEC) 1 (&gt;L:XMLSND14,enum) }
      (L:HUNADF, enum) 20 == if{ 0 (>L:HUNADF, enum) }

      (M:Event) 'RightSingle' scmp 0 ==
      if{ (L:HUNADF, enum) ++  20 min (>L:HUNADF, enum) (>K:ADF_100_INC) 1 (&gt;L:XMLSND14,enum) }
      (L:HUNADF, enum) 0 == if{ 20 (>L:HUNADF, enum) }

      (M:Event) 'WheelDown' scmp 0 ==
      if{ (L:HUNADF, enum) -- 0 max (>L:HUNADF, enum) (>K:ADF_100_DEC) 1 (&gt;L:XMLSND14,enum) }
      (L:HUNADF, enum) 20 == if{ 0 (>L:HUNADF, enum) }

      (M:Event) 'WheelUp' scmp 0 ==
      if{ (L:HUNADF, enum) ++  20 min (>L:HUNADF, enum) (>K:ADF_100_INC) 1 (&gt;L:XMLSND14,enum) }
      (L:HUNADF, enum) 0 == if{ 20 (>L:HUNADF, enum) }
      </CallbackCode>
    </MouseRect>
  </PartInfo>
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Apparently you still misunderstand the purpose of the bias. For the example above the bias of 50 accomplished nothing whatever...

Bias is used ONLY when it is necessary to offset the variable to move the zero point on a keyframe scale.

BTW, your "solution" is just fine... the goal after all is to have something that works!
 
Messages
39
For example, suppose you have a variable with a range of -100 to +100 for it's output.
Hi Mr.Bill!
How can I identify with variable with range of KF has ? And may I introduce my own L:var with range from -100 to +100 KF ?
Thank you very much!
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Hi,

The SDK has much of the information on default variable keyframes. And yes, you can create your own L: variables with any keyframe setup you want.
 
Messages
39
Hi,

The SDK has much of the information on default variable keyframes. And yes, you can create your own L: variables with any keyframe setup you want.
Thank you Tom, but how can I do that?
I know that <AnimLength> tag controls your animation KF range, but this is not the same thing which meant Mr.Bill!? Where am I wrong :confused:
Thanks =)
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Sorry, someone else will have to chime in, since I only create for FS9. The format is different.
 
Top