• 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 Manifold pressure needle(s)

euroastar350

Resource contributor
Messages
826
Country
us-delaware
Hi guys,

So I'm at the stage of coding the 3D engine needles on my Trislander project and I'm stuck on the manifold pressure needles. Current;y, I have them animated from 0-50, but I'm pretty much sure I need more keyframes then what I have currently. This is what the MP gauge looks like on the Trislander and I'm trying to achieve a more smoother animation and not one that jumps from one keyframe to another. Any help is appreciated.
BN2_MP.jpg
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
I used 120 frames for my C310R manifold pressure needle:

Code:
  <PartInfo>
    <Name>C310_needle_manifold_left</Name>
    <AnimLength>120</AnimLength>
    <Animation>
      <Parameter>
        <Code>
             (A:ELECTRICAL MASTER BATTERY,bool)
             if{ (A:RECIP ENG MANIFOLD PRESSURE:1, inHg) 52 / 120 *  }
           els{  (A:RECIP ENG MANIFOLD PRESSURE:1, inHg) 52 / 120 *  }
        </Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
  </PartInfo>
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
I used 120 frames for my C310R manifold pressure needle:

Code:
  <PartInfo>
    <Name>C310_needle_manifold_left</Name>
    <AnimLength>120</AnimLength>
    <Animation>
      <Parameter>
        <Code>
             (A:ELECTRICAL MASTER BATTERY,bool)
             if{ (A:RECIP ENG MANIFOLD PRESSURE:1, inHg) 52 / 120 *  }
           els{  (A:RECIP ENG MANIFOLD PRESSURE:1, inHg) 52 / 120 *  }
        </Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
  </PartInfo>

So do I animate from 0-120, then collapse using trajectories?
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Forget trajectories. Don't make it more complicated than it needs to be. :laughing:

Because my previous script example was from a different manifold gauge, I'll use another example which is closer to hand.

Let's start at the beginning and I'll explain my reasoning as we examine this. First of all, let's look at my manifold gauge:
vDi9K.jpg

Note that my gauge index begins at 10 inHg, so frames 0 through 10 have no movement at all. The highest index is 45 inHg, so to achieve smoother movement I've decided to double the total frames so the highest frame number will be 90.

First, we'll animate the needle.
  1. Click on the "Auto Key" button, then with the slider at frame 0, click the "Set Key" icon button (looks like a key).
  2. Move the slider to frame 20 and use the "Set Key" icon button to place a key there at index 10.
  3. Move the slider to frame 30 and use the "Rotate" tool (set to Local) to index 15. When you release the mouse button, a key will be automatically placed.
  4. Move the slider to frame 40 and repeat the above step (#3)
  5. Continue moving the slider and use the "Rotate" tool to place a key at each numbered index point, then a final key at frame 90 (45 inHg).
Note that this technique is especially suitable for index markings that are non-linear.

Next, we will need to script the needle's animation. One of the most important things to understand is this simple forumula:

SIM: Converts simvar to keyframes: simvar * scale + bias = keyframes

To convert our sim variable to keyframes we will need to divide by 45 (max value) then multiply the result by 90 (max keyframe), so:
Code:
  <PartInfo>
    <Name>C310_needle_manifold_left</Name>
    <AnimLength>90</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:RECIP ENG MANIFOLD PRESSURE:1, inHg) 45 / 90 *</Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
  </PartInfo>

There are other ways this could be done, but this is the easiest I've found. I hope it helps! :teacher:
 
Last edited:

euroastar350

Resource contributor
Messages
826
Country
us-delaware
Ah so it all makes sense now, I would have never thought of doubling the keyframes when animating. Again, much appreciated Bill:wizard:
 

tgibson

Resource contributor
Messages
11,344
Country
us-california
Wouldn't steps 2, 3 and 4 be keyframes 20, 30 and 40?
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Wouldn't steps 2, 3 and 4 be keyframes 20, 30 and 40?
Tom, since the index is truly linear, it would be possible but you'd still need to add a final key at 45 inHg.

I've just gotten into the habit of keying every major index point since it doesn't make any difference in terms of overhead, but can result in more accurate interpolation by the sim engine.

Also, I could have simply put the "bias" in the script instead of "wasting" the first 10 frames, but it would have made no real difference in the end result.
 
Last edited:

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Ah so it all makes sense now, I would have never thought of doubling the keyframes when animating. Again, much appreciated Bill:wizard:
No problem! I'm happy to share knowledge. I note that your MP index runs from 10 to 50, so obviously some slight modification to my example script will be required. That should be simple enough to do.
 

tgibson

Resource contributor
Messages
11,344
Country
us-california
Sorry, I guess I'm confused about how you set this up Bill. So you set the 0 and 10" points at keyframe 0 (understood), then set 10" at keyframe 10 and 15" at keyframe 15, and so on to 40" at keyframe 40, then set the 45" point at keyframe 90? How do you handle the sudden change of MAP/keyframe ratio? Or do you set two keyframes at 45" - keyframe 45 and keyframe 90?

Thanks,
 

euroastar350

Resource contributor
Messages
826
Country
us-delaware
At 10, the keyframe would be 0 and 20. So basically if the manifold goes from 0-45, you would simply double the numbers...meaning at 45, it would be keyframe 90 when animating, then use the above script to get your readout/animation.
 

tgibson

Resource contributor
Messages
11,344
Country
us-california
That's how I would do it, but that's not what Bill described...
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
That's how I would do it, but that's not what Bill described...
Actually that is sort of - kind of what I described, but apparently not clearly enough! :confused: Fortunately euroastar350 interpreted what I meant clearly enough...

Where I wrote "frame 10" it should have been "index 10, frame 20" to be more clear. :tongue-ti

I've edited my "instructions" to make it more clear (I hope!). Thanks for bringing this to my attention Tom.
 
Last edited:

tgibson

Resource contributor
Messages
11,344
Country
us-california
OK Bill, thanks. I thought I was missing a technique I didn't understand. Nice to know the simple way is the logical one. :)
 
Top