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

ADF animation

Messages
56
Country
canada
I'm trying to create an ADF tuner with knobs and dials representing units, tenths, hundreds and thousands.
I've used the same animation for the knobs and dials at 360 keyframes and a mousrect which seems to be ok. I'll post an example below (for the 100 units).
Where I'm struggling is with the <code> section of the animation.
The knobs and dials do turn on mouse clicks and wheel operation, but they're all over the map as far as reading the ADF setting.
Can anyone please explain the sequence after the (A:ADF ACTIVE FREQUENCY:1,KHz), eg what do the following mean in the code : "1000 / 10 % 36 * dnor" and why cant I get this to work !!!
Any help greatly appreciated.
Gary

<Animation name="knob_adf1_100" guid="2f86ea62-bfff-4d7f-a6c0-09e441e3ab7d" length="360" type="Sim" typeParam2="knob_adf1_100" typeParam="AutoPlay" />

<PartInfo>
<Name>knob_adf1_100</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 1000 / 10 % 36 * dnor</Code>
</Parameter>
</Animation>
</PartInfo>

<PartInfo>
<Name>mrec_knob_adf1_100</Name>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipID>TOOLTIPTEXT_ADF1_FREQ</TooltipID>
<MouseFlags>WheelDown+WheelUp+LeftDrag+LeftSingle</MouseFlags>
<CallbackJumpDragging>
<XMovement>
<Delta>10</Delta>
<EventIdInc>ADF_100_DEC</EventIdInc>
<EventIdDec>ADF_100_INC</EventIdDec>
</XMovement>
</CallbackJumpDragging>
</MouseRect>
</PartInfo>
 
1000 / is divide the frequency by 1000
10 % is 10 modulo, which is the remainder of the number obtained above divided by 10 (56 modulo 10 is 6)
36* multiplies the result by 36.
Dnor takes any number larger than 360 and subtracts 360 from that.

So since frequencies run between 100 and 1700:

1700 / 1000 =1.7
10 modulo = 1.7
1.7 * 36 =61.2

So that’s the largest key frame you can get.

But many people ignore the top band and limit it to 999. In that case the largest key frame would be 36.

100 / 1000 =0.1
10 modulo = 0.1
0.1 * 36 =3.6

So that’s the smallest key frame.

What you want is a number that goes between 0 and 360, so you have a full rotation. Or between 36 and 360, allowing for frequency numbers between 0 and 100 for appearance sake.

With the 36 * in there, that means a number between 0 and 10. That’s why they used modulo 10, which gives you that result.

But I don’t think that the 1000/ is going to give you what you want? If you limit it to 999, then 100 / would give a maximum key frame of 360, as desired.

That said, my understanding of this kind of stuff is limited and I could be all wrong?

Hope this helps,
 
Thanks for the response Tom I really do appreciate your trying to help.
I really am struggling with the calculations here ...

Are you saying all calculations have to begin with 1700 because of the maximum ADF frequency and end up equalling 360 ?

Forgive me, I'm trying to understand your advice and am struggling.

Here's where I'm at:

Units: <Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 1 / 10 % 36 * dnor</Code> -- the dial appears to show correct numbers for the ADF frequency, but it also rotates the 10's dial ??

10's: <Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 10 / 10 % 36 * dnor</Code> -- this dial is all over the map. I'm struggling with the calculation !!

100's: <Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 999 / 10 % 36 * dnor</Code> -- this dial turns too slowly to align with the ADF frequency, again I'm struggling with the calculation.

Thanks again Tom.

Gary
 
General Approach: Digit Extraction
To get each digit, you divide the value to shift the desired digit into the ones place, then take the remainder modulo 10.
  • Ones Digit: (A:AIRSPEED INDICATED, knots) 10 %
  • Tens Digit: (A:AIRSPEED INDICATED, knots) 10 / 10 %
  • Hundreds Digit: (A:AIRSPEED INDICATED, knots) 100 / 10 %
 
Thus the last one should divide by 100, not 999.

And the dnor statement is not needed - that’s for things like headings.

You still need to multiply by 36 to get 360 key frames.

And yes the other knobs turn. The way you have it coded they are all responding to the same ADF frequency. When a knob changes that frequency, all the other knobs respond. You would need to set up separate custom variables for each knob in the mouse section (of each knob) and then feed the results to the ADF frequency.
 
Last edited:
While most info is about gauges, this could be useful?

Do a Google search for:

fs2004 xml adf for each digit

And the AI gives you some good tips.

I’ve never created a 3D ADF gauge, so I’m trying…
 
Thank you so much Tom, you really are a gentleman.
You're clarification clicked with me and I think I finally get it.
I've got some work to do, but happy to report back when it's solved (fingers crossed).

Thanks again Tom, very much appreciated. I'm light years ahead in my thinking on this.

Gary
 
OMG !!! .... IT WORKS !!! I feel like a kid at xmas :)
Thanks Tom, your explanation of the digit coding above made the penny drop for me and your advise to search Google's AI section for "xml adf for each digit" led to a recommendation to use the "flr" syntax which lined every thing up nicely in the sim.
I've never used Google's AI before, it's a rally neat tool.
So everything is working perfectly and exactly as it should.

I'll post the code below incase anyone else can use it. Animations for the knobs and dials are at 360 keyframes and the animation for a particular knob is used for it's corresponding dial (drum).

Best wishes and thanks

Gary

As below :

<Animation name="knob_adf1_1000" guid="aec615a8-d45f-4f51-87b5-82bb075e93dd" length="360" type="Sim" typeParam2="knob_adf1_1000" typeParam="AutoPlay" />

<PartInfo>
<Name>knob_adf1_1000</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 1000 / flr 10 % 36 * dnor</Code>
</Parameter>
</Animation>
</PartInfo>

<Animation name="knob_adf1_100" guid="2f86ea62-bfff-4d7f-a6c0-09e441e3ab7d" length="360" type="Sim" typeParam2="knob_adf1_100" typeParam="AutoPlay" />

<PartInfo>
<Name>knob_adf1_100</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 100 / flr 10 % 36 *</Code>
</Parameter>
</Animation>
</PartInfo>

<PartInfo>
<Name>mrec_knob_adf1_100</Name>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipID>TOOLTIPTEXT_ADF1_FREQ</TooltipID>
<MouseFlags>WheelDown+WheelUp+LeftDrag+LeftSingle</MouseFlags>
<CallbackJumpDragging>
<XMovement>
<Delta>5</Delta>
<EventIdInc>ADF_100_INC</EventIdInc>
<EventIdDec>ADF_100_DEC</EventIdDec>
</XMovement>
</CallbackJumpDragging>
</MouseRect>
</PartInfo>

<Animation name="knob_adf1_10" guid="817938a8-5d5c-4e9e-b9aa-9f24ddcbc2b2" length="360" type="Sim" typeParam2="knob_adf1_10" typeParam="AutoPlay" />

<PartInfo>
<Name>knob_adf1_10</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>(A:ADF ACTIVE FREQUENCY:1,KHz) 10 / flr 10 % 36 *</Code>
</Parameter>
</Animation>
</PartInfo>

<PartInfo>
<Name>mrec_knob_adf1_10</Name>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipID>TOOLTIPTEXT_ADF1_FREQ</TooltipID>
<MouseFlags>WheelDown+WheelUp+LeftDrag+LeftSingle</MouseFlags>
<CallbackJumpDragging>
<XMovement>
<Delta>5</Delta>
<EventIdInc>ADF_10_INC</EventIdInc>
<EventIdDec>ADF_10_DEC</EventIdDec>
</XMovement>
</CallbackJumpDragging>
</MouseRect>
</PartInfo>

<Animation name="knob_adf1_1" guid="cbe477be-30d9-44b7-85fa-5d7d9a8eb502" length="360" type="Sim" typeParam2="knob_adf1_1" typeParam="AutoPlay" />

<PartInfo>
<Name>knob_adf1_1</Name>
<AnimLength>360</AnimLength>
<Animation>
<Parameter>
<Code>(A:ADF ACTIVE FREQUENCY:1,KHz) flr 10 % 36 *</Code>
</Parameter>
</Animation>
</PartInfo>

<PartInfo>
<Name>mrec_knob_adf1_1</Name>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipID>TOOLTIPTEXT_ADF1_FREQ</TooltipID>
<MouseFlags>WheelDown+WheelUp+LeftDrag+LeftSingle</MouseFlags>
<CallbackJumpDragging>
<XMovement>
<Delta>5</Delta>
<EventIdInc>ADF_1_INC</EventIdInc>
<EventIdDec>ADF_1_DEC</EventIdDec>
</XMovement>
</CallbackJumpDragging>
</MouseRect>
</PartInfo>
 
Back
Top