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

Adding animation/switch in MCX

Messages
116
Country
canada
Hi,

Im adding switches to a VC and I want to know how to make custom animations. How can I make toggleable dummy switches? How do I modify the model def without messing it up?

Thanks!
 
Add your new sections to the top of the modeldef file parts section. If your code is bad no animations below that will work in the sim.


The way to create dummy animations is to use something like this in the CallbackCode:

(L:Dummy1, bool) ! (>L:Dummy1, bool)

This changes the value of the L: variable from false (0) to true (non-zero, either 1 or -1?) and back

and in the Animation section use something like this:

XML:
    <Animation>
       <Parameter>
       <Code> (L:Dummy1,bool) 100 * </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>

Play with the 100 * until you get the motion correct (depends on the Animation Length, this is for 100 keyframes, and if reversed use -100 * ). Play with the Lag value to get the switch throwing speed correct.

The whole thing would look something like this (NOT TESTED):

XML:
    <Animation name="dummy_switch1" guid="3020b7f6-f1f3-48f9-b464-5ff89fff4ffd" length="100" type="Sim" typeParam2="dummy_switch1" typeParam="AutoPlay" />

<PartInfo>
    <Name>dummy_switch1</Name>
    <Animation>
       <Parameter>
       <Code> (L:Dummy1,bool) 100 * </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>
<MouseRect>
       <Cursor>Hand</Cursor>
       <TooltipText>This is a dummy switch.</TooltipText>
        <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
                    (L:Dummy1, bool) ! (>L:Dummy1, bool)
          </CallbackCode>
    </MouseRect>
</PartInfo>
 
Last edited:
You are the best Tom!

I have another question: I'm making multiple switches and I am adding multiple new animations, but even though I assign each distinct animation in MCX, in the simulator when I click on one, all the new dummy switches I added all activate.. how can I prevent that from happening? Like they all have a unique animation and mouse rec, but they still activate at the same time.
 
Last edited:
They all have to respond to different variables in the Animation sections. And all those variables cannot be connected by code to act together in another VC gauge or in a 2D gauge.

Create or download a gauge that prints out all of these variables on the panel. Then figure out why they are acting together.
 
They all have to respond to different variables in the Animation sections. And all those variables cannot be connected by code to act together in another VC gauge or in a 2D gauge.

Create or download a gauge that prints out all of these variables on the panel. Then figure out why they are acting together.
I got it.

Now if you don't mind helping me again, I have a switch knob that I want to be able to click and stop at different intervals. (For example: Windshield wiper dial that goes slow, medium, fast) Wat would be the coding for that animation?
 
The simplest way in the VC is to use Left click for decrease, Right click for increase (reverse the signs in the MouseRect section for opposite effect). We'll use values of 0, 1 and 2 for the variable (slow, medium, fast). Assuming the keyframes are 0, 50, and 100 (slow, medium, fast) something like this in the Animation section:

NOT TESTED

XML:
<Animation>
       <Parameter>
       <Code> (L:WiperSpd,enum) 50 * </Code>
        <Lag>100</Lag>
       </Parameter>
    </Animation>

And then you need to set those values in the MouseRect section:

XML:
<MouseRect>
       <Cursor>Hand</Cursor>
       <TooltipText>Wiper Speed.</TooltipText>
        <MouseFlags>LeftSingle+RightSingle</MouseFlags>
        <CallbackCode>
            (M:Event) 'LeftSingle' scmp 0 ==
            (L:WiperSpd,enum) 0 &gt; &amp;&amp;
                if{    
                    (L:WiperSpd,enum 1 - (&gt;L:WiperSpd,enum)
                    }
            (M:Event) 'RightSingle' scmp 0 ==
            (L:PRR_set, number) 2 &lt; &amp;&amp;
                if{    
                    (L:WiperSpd,enum) 1 + (&gt;WiperSpd,enum)
                    }
          </CallbackCode>
    </MouseRect>
 
Back
Top