1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FSX FSX XML help

Discussion in 'Modeling' started by delivery guy, 23 Jun 2011.

  1. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,733
    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>
     
  2. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    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: 3 Jul 2011
  3. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,733
    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: 3 Jul 2011
  4. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    Country:
    unitedstates
    Very nice how you broke it down.

    I saved it to me formulas.....thanks Bill,

    DG:eek:
     
  5. delivery guy

    delivery guy

    Joined:
    31 Jan 2010
    Messages:
    1,526
    Country:
    unitedstates
    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>
     
  6. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,733
    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!
     
  7. Axel_A1R-db

    Axel_A1R-db

    Joined:
    8 Nov 2012
    Messages:
    38
    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!
     
  8. tgibson

    tgibson

    Joined:
    22 Sep 2006
    Messages:
    6,855
    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.
     
  9. Axel_A1R-db

    Axel_A1R-db

    Joined:
    8 Nov 2012
    Messages:
    38
    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 =)
     
  10. tgibson

    tgibson

    Joined:
    22 Sep 2006
    Messages:
    6,855
    Country:
    us-california
    Sorry, someone else will have to chime in, since I only create for FS9. The format is different.
     

Share This Page