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

XML animation doubt

Messages
549
Country
nicaragua
Hi!
I have this problem that's been making me grind my teeth for a while:
So I have this part code that animates the nozzle of the plane when the side slip speed of the plane is greater than 2 radians per second:
<part>
<name>Slip_corrector</name>
<animation>
<parameter>
<code>
(A:Incidence beta, radian per second) 2 &gt;
if{ 100 }
els{ 0 }
</code>
<lag>35</lag>
</parameter>
</animation>
</part>

I wanted to make the part work from frame 50 to 0 when the plane slides the tail left and from 50 to 100 when the tail slides right, but I can't seem to find a way to put two diferent values on the same part.
Can you help me please!?
Thanks!
 
Well, just like a rudder, you need to keyframe from 0 - 50 - 100, and then add an offset to your XML script, so that -50 = frame 0, 0 = frame 50, and 50 = frame 100:

Code:
<code>
     50 (Some formula that will yield -50 to +50) +
</code>
 
Thanks!
But is that 50 an arbitrary value? Can't I put, for example "-2 to 2"?
 
Thanks!
But is that 50 an arbitrary value? Can't I put, for example "-2 to 2"?

You are dealing with two scales here:

1: from your "variable/formula"

2: the keyframes used

The task is to write your script such that it translates (scales) the "formula scale" to the "keyframe scale."

So, if you wanted to use "-2 to 2" yet keep the keyframes 0 - 50 - 100, then you simply need a "scalar" (multiplier) to convert one to the other...

Code:
<code>
     50 (Some formula that will yield -2 to +2)  25 * +
</code>

So, now we are multiplying by 25 (our conversion scalar) then adding 50 (the offset) to the result:

Code:
var * scalar + offset = keyframe

-2 * 25 + 50 = 0

0 * 25 + 50 = 50

2 * 25 + 50 = 100

If you wanted to keyframe from 0 - 20 - 40, then you'd need to calculate a new scalar + offset pair.

Is this beginning to make sense now? :D

In the FS9 SDK at the top of the makeMDL.parts.xml file ACES had comments that essentially stated this "conversion/scalar formula" but their terminology was just a bit different:

simvar * scale + bias

It took me a long time to realize that we aren't limited to using a pre-defined sim-variable, nor are we limited to the special <tags> they provided: <Scale> and <Bias>, but indeed we can use any bloody thing we want!
 
Last edited:
Back
Top