• 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 COM Radio Animation Issues

Messages
468
Country
ca-ontario
I've just spent hours trying to get a Mhz dial on my COM radio to animate and it simply refuses to play fair. :mad:

I've reset the transforms, checked it was animated in 'local' mode, checked the pivot point settings and re-animated multiple times with no luck.

I am trying to use the stock COM1 code in the modeldef file shown here:

Code:
<PartInfo>
    <Name>knob_com_MHz0</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:COM1 STANDBY FREQUENCY, MHz) 118 - flr dnor</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>hand</Cursor>
      <TooltipID>TOOLTIPTEXT_COMM1_FREQ_ACTIVE_STANDBY</TooltipID>
      <MouseFlags>WheelUp+WheelDown+LeftDrag+LeftSingle</MouseFlags>   
      <CallbackJumpDragging>
        <XMovement>
          <Delta>7</Delta>
          <EventIdInc>COM_RADIO_WHOLE_INC</EventIdInc>
          <EventIdDec>COM_RADIO_WHOLE_DEC</EventIdDec>
        </XMovement>
      </CallbackJumpDragging>
    </MouseRect>
  </PartInfo>

I have animated the part over 360 frames and I have tried adding key frames as follows:

0, 180, 360 frames

and

0, 90, 180, 270, 360 frames

Neither of the above work.

For reference the part is a flat disc viewed face on (like looking at the face of a coin) and the tuning digits are visible in a cut-out in the radio body as the disc rotates counter-clockwise.

What I am trying to do is to get the disc to rotate CCW by one whole increment per mouse/wheel click (which equates to a rotational angle of 18.94736842105263° - I used 18.95° when placing the digits and that worked out well).

In FSX the disc does not move at all but the mouse-over tool-tip does show the Mhz value going up/down as I click or wheel over the part and checking it against the default 2D BK NAV/COM confirms the digit changes.

Again for reference here is the [Radios] section from the aircraft.cfg file:


[Radios]
// availiable, standby frequency, has glide slope
Audio.1= 1
Com.1= 1, 0
Com.2= 1, 0
Nav.1= 1, 0, 1
Nav.2= 1, 0, 0
Adf.1= 1
Adf.2= 1
Transponder.1= 1
Marker.1= 1


Any ideas where I'm going wrong or what may be stopping the animation from working?
 
I'm not sure if you want to tune the ACTIVE or STBY COM frequency, but in the code there is (A:COM1 STANDBY FREQUENCY, MHz)
So your frequency is tuned by the active, but your animation is (not) driven by the standby frequency o_O
 
That's the only value there is to operate the function. Apparently if you have no standby freq. on your radio it tunes the active instead.

I've been messing with this all day again and still can't get anywhere. I tried animating the NAV dials too and they don't work either despite working perfectly in my other model using the same code.

I'm coming to the conclusion that something is porked in the model parts themselves as I just animated the 'dummy' volume knob and that worked perfectly so this evening I am going to try re-building them from scratch to see if that solves the issue.
 
Try this instead:
Code:
<Code>(A:COM ACTIVE FREQUENCY:1,MHz) 118 - flr dnor</Code>
 
Bill might be right.

Your aircraft.cfg shows no standby frequency for the radio so reading the value should produce no results.

I like to read the results of any formula I use just to double check that the values are returning useful numbers.

So something like this and then make a little XML gauge to display the L:temp1 and L:temp2 values (in truth I have a big XML gauge which displays every A var that FSX generates and any L var I need).

Code:
 <Code>(A:COM1 STANDBY FREQUENCY, MHz) 118 - flr dnor (&gt;L:temp1)
(A:COM ACTIVE FREQUENCY:1, MHz) 118 - flr dnor (&gt;L:temp2)
</Code>
 
I just tried Bill's code and I am now getting some movement from my part but it is very weird. Instead of turning through 360° CCW I get the whole radio band (118-136 Mhz) being accessed (as shown by a 2D BK radio in a pop-up panel) while my dial moves from 118 to 119 Mhz which equates to 18.94736842105263° or what should be one step on the dial.

I have animated the dial through 360° (CCW) over 360 frames and have key-frames at 0, 90, 180, 270 and 360 frames.

Confused! :confused:
 
I've just spent several more hours trying to get this animation to work with no luck. I even used some of Fr. Bills code found here, http://www.fsdeveloper.com/forum/threads/com-knobs-and-drums-wth.431700/#post-686571 , but the best I can get is about 15-19° of rotation for the entire radio range instead of the req'd 360° of rotation.

I have no idea what is going wrong and I have re-animated the part multiple times while trying various amounts of keyframes and nothing seems to fix the issue.

Does anyone have any working code for a simple dial operated NavCom radio they would be willing to share?

For reference I have attached a photo of the radio I am working on but I will be making it cover the full 720 channels available in FSX.
 

Attachments

  • king kx_130 photo.JPG
    king kx_130 photo.JPG
    34.4 KB · Views: 439
Larry, it might be simplest to assign a key for each digit at 10 frame intervals. Then you can use something like this to select each digit:
Code:
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:TuneDigit,enum) 10 *</Code>
        <Lag>30</Lag>
      </Parameter>
    </Animation>
The <Lag> will allow the dial to rotate smoothly from digit to digit, instead of snapping instantly...

For the mouse section, something like this would work:
Code:
      <CallbackCode>
         (M:Event) 'LeftSingle'  scmi 0 ==
         (M:Event) 'WheelDown'  scmi 0 == or
         if{ (L:TuneDigit,enum) -- 0 max (>L:TuneDigit,enum) }

        (M:Event) 'RightSingle' scmi 0 ==
        (M:Event) 'WheelUp'     scmi 0 == or 
        if{ (L:TuneDigit,enum) ++ 36 min (>L:TuneDigit,enum) }
      </CallbackCode>
 
Last edited:
Unfortunately XML coding is not my strong point Bill so I have no idea how to even go about what you suggest....sorry.

EDIT: I see you have added some code to your previous post, thanks for that but I would still need the mouse code to actually change the radio frequencies so I'm not sure how to include that in your code.
 
Last edited:
I've just tried your code Bill and I've got it working partially but there are 'issues'.

I had to change the animation code to 20 * and KF every 20 frames in order to fit the steps into 360° of rotation. I also had to reverse the (M:Event) values in order to get the dial operating in the correct direction (i.e. left click or wheel up increases the displayed digit value, right click or wheel down decreases the displayed digit value).

The dial now rotates in the correct direction and the steps match the digits perfectly BUT:

1. The dial stops at 136 Mhz (i.e. frame 360) instead of continuing to rotate to 118 Mhz (i.e.frame 0).

2. Right click does not do anything but wheel down rotates the dial CCW. However, if you left click or wheel up until you reach frame 360 (i.e. 136 Mhz on the dial) then the mouse wheel stops working and you can't come back down the frequency range, you are effectively trapped on frame 360.

Here is the code I am using:

Code:
<PartInfo>
    <Name>NavA_com_MHz</Name>
    <AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
       <Code>(L:TuneDigit,enum) 20 *</Code>
        <Lag>30</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
       <TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
      <MouseFlags>WheelUp+WheelDown+LeftDrag+LeftSingle</MouseFlags> 
      <CallbackCode>
         (M:Event) 'LeftSingle'  scmi 0 ==
         (M:Event) 'WheelDown'  scmi 0 == or
         if{ (L:TuneDigit,enum) ++ 36 min (>L:TuneDigit,enum) }

        (M:Event) 'RightSingle' scmi 0 ==
        (M:Event) 'WheelUp'     scmi 0 == or
        if{ (L:TuneDigit,enum) -- 0 max (>L:TuneDigit,enum) }
        </CallbackCode>
        </MouseRect>
    </PartInfo>

Have you any idea why I am having the right click issues and why I can't get continuous rotation on the dial?

Once I can get this animation sorted I can think about getting the mouse code to actually tune the radio too.
 
Larry, the 'wheel' is stopping because it's doing just what the script tells it to do via the xx min and yy max specifications!

Here is some modified script that will provide continuous rotation. Now the "fun part" will be synchronizing the value of (L:TuneDigit,enum) with the actual frequency to be 'tuned...'

Just for the record however, assuming that this venerable radio used a variable capacitor, those are mechanically incapable of rotating past their lower and upper stops! Notice the brown bakelite 'bar' that maintains the spacing of the capacitor plates? That prevents continuous rotation, which is why I wrote the script using 36 min 0 max.

50pf.jpg


Code:
    <MouseRect>
      <Cursor>Hand</Cursor>
       <TooltipText>COM Freq - %((A:COM ACTIVE FREQUENCY:1, MHz))%!3.3f!MHz</TooltipText>
      <MouseFlags>WheelUp+WheelDown+LeftDrag+LeftSingle+RightSingle+RightDrag</MouseFlags>
      <CallbackCode>
         (M:Event) 'LeftSingle'  scmi 0 ==
         (M:Event) 'WheelDown'  scmi 0 == or
         if{ (L:TuneDigit,enum) ++  (>L:TuneDigit,enum) }

        (M:Event) 'RightSingle' scmi 0 ==
        (M:Event) 'WheelUp'     scmi 0 == or
        if{ (L:TuneDigit,enum) --  (>L:TuneDigit,enum) }

        (L:TuneDigit,enum) -1 == if{ 36 (>L:TuneDigit,enum) }
        (L:TuneDigit,enum) 37 == if{ 0 (>L:TuneDigit,enum) }
        </CallbackCode>
        </MouseRect>
 
Thinking about it some more, probably the simplest way to implement the 'tuning' would be to use a @Macro to set the the desired whole frequency by passing the (L:var,unit) value.

Code:
<MacroName="SetCOM1">
    118 @1 + 100 * near 10000 % d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * + (&gt;K:COM_RADIO_SET)
</Macro>

<!-- In the mouse callback script -->
  @SetCOM1((L:TuneDigit,enum))
But that begs the question of how you are going to tune the fractional part of the frequency?
 
Larry, the 'wheel' is stopping because it's doing just what the script tells it to do via the xx min and yy max specifications!

Just for the record however, assuming that this venerable radio used a variable capacitor, those are mechanically incapable of rotating past their lower and upper stops! Notice the brown bakelite 'bar' that maintains the spacing of the capacitor plates? That prevents continuous rotation, which is why I wrote the script using 36 min 0 max.

DOH! I should have remembered that from my Ham Radio days! Shame on me! :banghead:

I am good with the stopping at the ends now but thanks for your other code anyway.

The good news is that I now have a working COM Mhz dial. In addition I applied what I learned to the Khz dial and that works now too! :)

Now I can go and do the same to the NAV side of the radio. :laughing:
 
Last edited:
Welcome to the jungle :)

We've got fun and games
We've got everything you want honey, we know the names
We are the people that can find whatever you may need
If you got the money, honey, we got your disease

To the jungle, welcome to the jungle
Watch it bring you to you shananananananaknees, knees
To the jungle, welcome to the jun-

Sorry, got carried away there for a bit. :D
 
I've noticed a bit of an anomaly with both the COM and NAV radios I've been working on and wondered if there was a way to fix it.

When the aircraft loads the knobs/dials are at the extreme CW position on the dials (i.e. the COM shows 118.000 and the NAV shows 108.000).

However the mouse-over tool-tips show the currently tuned frequencies of both radios as displayed on a pop-up 2D radio. Once you click on a tuning knob/dial the mouse-over and 2D radio jump to the set frequency of the knobs/dials.

Is there a way of forcing the dials to the currently active frequency on aircraft load to prevent this happening?
 
Back
Top