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

FSXA Kohlsman scale animation/code

Discussion in 'Modeling' started by euroastar350, 24 Aug 2017.

  1. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    640
    Country:
    puertorico
    Hi guys,

    Quietly plugging away at the Trislander and need help/advice on the animation of the Kohlsman scale. I have the part(s) modeled and textured, but not animated just yet. How would I go about the animation and proper code to make it functional?

    BTW, the Trislander just passed the 300,000 polygon mark with more or less to be added ;)
    render_070.png render_071.png
     
    antaris likes this.
  2. antaris

    antaris

    Joined:
    8 Feb 2008
    Messages:
    911
    Country:
    mexico
    Hi George

    First is first. I am sure the scale is incorrect. To prove it, I grabbed the gauge to the simulator:

    Alt_reading_01.jpg

    I had this readings:
    1. From the image, 1015.5 mbar and something close to 30.087 inHg.
    2. Correct 1:1 match: 1015.5 mbar its real equivalent is a value close to 29.9877 inHg
    1 mbar = 0.02952999 inHg
    1 inHg = 33.86388 mbar


    The result in the actual scale:
    Alt_reading_02.jpg

    As you can see, the scale is utterly wrong (all is my fault; I am very sorry). When we designed the art for the 206, at least I never tested the 2D gauge in the simulator... until now. :oops: :oops: :oops:

    Another issue, it is unknown to me which are the inicial and final values for each side; that would make it easier to rectify or correct the scale. That being said, lets supose that the actual scale is correct and each value in mbars matches horizontally with its equivalent inHg (for reference). From my real limited knowledge doing custom animations, once the scale is right, you need to animate the rotation considering the range of values and the exact angles where the initial and final values are seated on the scale. Here is the code I used for this scale in the 2D gauge (FS9 version):

    HTML:
       <Element>
          <Position X="375" Y="375"/>
          <Image Name="206_altimeter_Kohlsman.bmp">
             <!--<Axis X="375" Y="375" PointsTo="East"/> -->
             <Axis X="375" Y="375"/>
          </Image>
          <Rotate>
             <!-- <Value Minimum="29.70" Maximum="30.30"> (A:Kohlsman setting hg, inHg)</Value> -->
             <!-- <Value>(A:Kohlsman setting hg, inHg)</Value> -->
             <Value> (A:Kohlsman setting hg, inHg) 29.60 max 30.40 min </Value>
             <Failures>
                <GAUGE_ALTIMETER Action="Freeze"/>
                <SYSTEM_PITOT_STATIC Action="Freeze"/>
                      <SYSTEM_ELECTRICAL_PANELS Action="Freeze"/>
             </Failures>
               <Nonlinearity>
                 <Item Value="29.60" X="374" Y="66"/>
                 <Item Value="30.40" X="375" Y="684"/>
               </Nonlinearity>
          </Rotate>
       </Element>
    It should be easier for you to translate this code to a custom animation.

    Also, attached to this thread, is the actual gauge (it does not have implemented the calibration button). The issue at hand has not been solved; however some problems have been spotted before you begin to code the 3D altimeter. I am sure that you will get it right and the real help is on the way.

    Addendum:
    This sort of work, in the real world is made with a proper CAD program in order to have precise measurents. At least for me, in photoshop is very hard to get the rotations right. The program shifts the selection from the geometric center each time I attempt to rotate segments of an image. For that reason, the program "offers" the option to choose the center of rotation. It is not the same to rotate pixels than mechanical pieces! This is not an excuse, I did it wrong.
     

    Attached Files:

    Last edited: 25 Aug 2017
  3. Paul Domingue

    Paul Domingue Resource contributor

    Joined:
    21 Jun 2011
    Messages:
    1,417
    Country:
    us-maine
    If it is a 3d gauge search the modeldef.xml file for drum_kohlsman, it will give you all the information you need.
     
  4. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    640
    Country:
    puertorico
    I see 2 different codes, one for "MB and one for "InHg", so I'm not sure which one to use. Since these are 3D parts, where does the keyframe start and end for animations?
     
  5. Paul Domingue

    Paul Domingue Resource contributor

    Joined:
    21 Jun 2011
    Messages:
    1,417
    Country:
    us-maine
    Use the measurement scale that would apply for the aircraft. FSX is set for InHg which is used in all modern aircraft. If the gauge was in a Spitfire it would read in Mb.
    The stock code is set to 360 frames but you can write your own code using the number of frames you need. Just copy the stock code and alter it as needed. Don't forget to give your code a new name and GUID. Follow the guidelines stated in the SDK for creating custom code.
     
  6. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,803
    Country:
    unitedstates
    If it were me, I'd keyframe animate the disk using the Mb scale, since it uses "whole numbers." This way the inHb would remain synchronized with the Mb setting.
     
  7. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    640
    Country:
    puertorico
    Where would I place the start and end keyframes when animating? Other then that, great useful tip and now I can have a properly animated altimeter :)
     
  8. tgibson

    tgibson

    Joined:
    22 Sep 2006
    Messages:
    6,951
    Country:
    us-california
    My FSX SDK modeldef.xml file contains no such drum_kohlsman part, nor anything related to kohlsman or drum. Weird.
     
  9. Paul Domingue

    Paul Domingue Resource contributor

    Joined:
    21 Jun 2011
    Messages:
    1,417
    Country:
    us-maine
    You should find drum_kohlsman animation names a few lines below <!-- Begin created by Virtuali for FA-18 --> which is line #401 in the modeldef.xml file for FSXA. If you only have the older FSX SDK minus A that may be the reason you don't see it.
     
  10. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,803
    Country:
    unitedstates
    You have a total of 13 whole numbered MB data points. Allowing for 5 'units' for each major tickmark, you would need 60 frames total.

    980 @ frame 0
    985 @ frame 5
    990 @ frame 10
    etc.
    1040 @ frame 60
    Code:
          <Parameter>
            <Code>(A:KOHLSMAN SETTING MB, millibars) 980 - 0 max 60 min</Code>
          </Parameter>
    A very important rule for animation in modeldef.xml scripts is this forumula:
    Code:
    SIM: Converts simvar to keyframes: simvar * scale + bias = keyframes
    For this application, no "scale" is required so we can leave it out.
    (A:KOHLSMAN SETTING MB, millibars) is our "simvar"
    980 is our "bias"

    simvar - bias = keyframe

    980 - 980 = frame 0
    985 - 980 = frame 5
    990 - 980 = frame 10
    etc.
    1040 - 980 = frame 60

    We want to limit the range of the animation so we include the min and max range limits. It's actually a quite simple and elegant solution!
     
    Last edited: 29 Aug 2017
    antaris and euroastar350 like this.
  11. euroastar350

    euroastar350 Resource contributor

    Joined:
    28 Jul 2010
    Messages:
    640
    Country:
    puertorico

    You are the man Bill, this is most excellent. Now it's off to finish the altimeter on the Trislander :)
     
    antaris likes this.
  12. tgibson

    tgibson

    Joined:
    22 Sep 2006
    Messages:
    6,951
    Country:
    us-california
    Hi,

    Correct, I only have the SP2 SDK.
     
  13. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,803
    Country:
    unitedstates
    For whatever it's worth, I consider the 'formula' above to be so important that I keep it, along with some other tips as "comments" at the very top of every modeldef.xml file!

    I hope my explanation of how the 'formula' translates in actual practice was clear, so your next animation task becomes easier. :teacher:
     
    antaris likes this.
  14. Paul Domingue

    Paul Domingue Resource contributor

    Joined:
    21 Jun 2011
    Messages:
    1,417
    Country:
    us-maine
    Ton, install the P3D SDK and use it instead.
     
  15. antaris

    antaris

    Joined:
    8 Feb 2008
    Messages:
    911
    Country:
    mexico
    Finally! I was not sure what was the purpose of "bias". In my English-Spanish dictionary that word make no sense to me in "Flight Simulator English", now I know -at least- how to use it. Thank you Fr. Leaming, this thread is saved in my HD!
     
  16. n4gix

    n4gix Resource contributor

    Joined:
    26 Sep 2006
    Messages:
    10,803
    Country:
    unitedstates
    You are most welcome. I mentioned that the specific example does not require a "scale" because we want to have the sim use all of the frames, not just the ones that are keyed.

    If we needed to script a kohlsman knob to rotate continuously around a 360ยบ arc, we'd need to add a "scale" parameter to the <Code> entry:
    Code:
          <Parameter>
            <Code>(A:KOHLSMAN SETTING MB, inHg) 28 - 300 * dnor</Code>
          </Parameter>
    In this case we wind up with simvar bias - scale *
    We would also need to "normalize" the calculation by adding a "dnor" (degrees normalization).
     
    antaris likes this.

Share This Page