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

How do you rotate 2D XML knobs for endless rotation or fixed points -- for autopilot, radios, overhead, etc

Messages
17
Country
unitedstates
I'm trying to establish the best method for creating XML 2D knob visual movements (and 3D if it's the same). After looking at several 2D knob gauges I'm really confused because I see it being done in really simple ways (minimal code) and then also really complex (lots of code)..literally the same knobs and functions but in vastly different ways. I know what I want to do. I just don't know the best method to achieve it.

I'm working on autopilot knobs (Altitude select, Heading select, Course select, IAS speed select, Vertical speed selector wheel). In some cases of code I've reviewed as a starting point I've seen just the basic variable or values expressed and not much else save for maybe just one or two knob bitmaps, while in others I've seen a nonlinearity table, and in some gauges I see a lot of bitmaps which show the knob in many different positions. So again, same function in three vastly different ways.

In all 5 cases below of what I'm working on these are obviously endless rotary encoders so my intuition said I did not think you would use a nonlinearity table and XY coordinates as an endless rotating knob shouldn't have a start point or end-point right? I'm just really confused here.

While functional, most of the knobs I've reviewed appear to move really jerky so I want to avoid that within reason. I want the knobs to visually appear like they are rotating much more smoothly.

Is this something you would have to create a piece of art for every 10 degrees? (so like 36 bitmaps for 360 degrees?) -- Or, like with needle movement can a single graphic be used instead? And if so.. how?

If I want all of the knobs to appear like they have smooth endless movement in either direction what are the various methods to accomplish this (as there looks like there is at least two ways if not three) and what is considered to be the best way for this?

Does each one of the 5 knobs below have to use a different style or can they all use the same basic code formula with the same amount of visual animations / bitmaps?

Lastly, how do you tell it (the knob graphic) how much to visually twist or turn per mouse click? Is this done in the variables section or the mouse click section... or both?

1 - I would think for an Altitude knob you would want 50ft per click or 100 feet per click or can this also be set-up somehow based on the speed of clicks? So the faster you click it moves in larger increments such as 100s or 200s, 500s etc, and when clicking slowly it decreases the value to like 50ft, or 10ft, etc. (or by holding the mouse button down it engages larger increments)

2 - Same with Heading knob, faster clicks (or holding the button) spins the heading bug in larger heading increments and slower clicks result in fine-tuning.

3 - Same as above with Course knob.. what's best here?

4 - Same as above with Indicated Air Speed knob.. what's best here?

5 - With the Vertical Speed Wheel, I assume the same rules apply as above but just uses vertical rectangle graphics instead.

Thanks in advance for the help!
 
Last edited:
I think if you just specify Repeat="Yes" most of that will happen automatically?
 
I'm talking about XML.. Baby steps guys..baby steps lol. -- And by repeat=yes, I'm not sure what you mean or where that gets inserted. I mean I get that <Click Repeat="Yes"> for the mouse affects the action, but what about the physical characteristic of the knob so that it visually appears to rotate? Doesn't it need more added in the Element section?

Here's a basic example I'm talking about with just one bitmap.

<Gauge Name="Altitude Selector Knob" Version="1.0">
<Size X="nnn" Y="nnn" />

<Element>
<Position X="nn" Y="nn"/>
<Image Name="AP_KNOB_ALT.bmp">
<Axis X="nn" Y="nn"/>
</Image>
<Rotate>
<Value>(A:Autopilot Altitude Lock Var, feet)</Value>
</Rotate>
</Element>

<Mouse>
<Area Left="nn" Width="nn" Top="nn" Height="nn">
<Tooltip>Autopilot Altitude (%((A:Autopilot Altitude Lock Var, feet))%!d! feet)</Tooltip>
<Cursor Type="DownArrow"/>
<Click Repeat="Yes">
(&gt;K:AP_ALT_VAR_DEC) (G:Var5) 10 - s0 0 &lt; if{ 340 } els{ l0 } (&gt;G:Var5)
</Click>
</Area>
<Area Left="nn" Width="nn" Top="nn" Height="nn">
<Cursor Type="UpArrow"/>
<Click Repeat="Yes">
(&gt;K:AP_ALT_VAR_INC) (G:Var5) 10 + s0 360 &gt; if{ 0 (&gt;G:Var5) } els{ l0 } (&gt;G:Var5)
</Click>
</Area>
</Mouse>

</Gauge>
 
Last edited:
Check this post especially the 3th comment "modulo" is your friend here, I have plenty of them on my panel
 
Last edited:
Back
Top