• 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 Conditional animation issue

Messages
358
Country
ca-ontario
Hi folks, I'm back to modelling again after taking a hiatus for several months over the summer. :)

As usual in cases like this it seems I've forgotten more than I've remembered and I'm stumped on a conditional animation and could do with some help (XML coding was never my strong point!) :rolleyes:

Here's the scenario, my current model has an opening glove box close to the co-pilot's yoke and I have 'interference' between the yoke and the glove box door/lid (i.e. at various points in the animation one part passes through the other part). What I would like to do is set up a conditional animation on the glove box door/lid so that you cannot operate it unless you have hidden the co-pilot yoke first. The door operates fine on it's own as does the yoke and the yoke visibility but when I try to make the suggested conditional animation the yoke still hides but the door/lid only opens roughly 1/4" (6mm) before it stops.

Here are the working code blocks that I've been using:
Glove Box
Code:
<PartInfo>
    <Name>NavA_glove_box_door</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:glove_box_door, bool) 50 *
        </Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <MouseFlags>LeftSingle</MouseFlags>
      <Cursor>Hand</Cursor>
        <CallbackCode>
          (L:glove_box_door, bool) ! (&gt;L:glove_box_door, bool)
        </CallbackCode>
         <TooltipText>Glove Box Door</TooltipText>
    </MouseRect>
  </PartInfo>

Yoke Animation/Visibility
Code:
<PartInfo>
    <Name>Navion_hide_copilots_yoke</Name>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Hide Copilot's Yoke</TooltipText>
            <CallbackCode>
                (L:Navion_YokeCoPilot,bool) ! (&gt;L:Navion_YokeCoPilot,bool)
            </CallbackCode>
        </MouseRect>
   </PartInfo>

   <PartInfo>
       <Name>Navion_yoke_copilot</Name>
        <Visibility>
               <Parameter>
              <Code>(L:Navion_YokeCoPilot,bool) 0 &gt; if{ 0 } els{ 1 }</Code>
               </Parameter>
        </Visibility>
   </PartInfo>

My first attempt at the conditional code was based on altering the 'code' section of the glove box code like this:

Code:
 <Code>
          (L:glove_box_door, bool) 50 *
          (L:Navion_YokeCoPilot,bool) ! (&gt;L:Navion_YokeCoPilot,bool)
          and
        </Code>

My second attempt was based on the condition in the glove box 'mouse rectangle' section like this:

Code:
<MouseRect>
      <MouseFlags>LeftSingle</MouseFlags>
      <Cursor>Hand</Cursor>
        <CallbackCode>
          (L:glove_box_door, bool) ! (&gt;L:glove_box_door, bool)
          (L:Navion_YokeCoPilot,bool) 0 &gt; if{ 0 } els{ 1 }
          and
        </CallbackCode>
         <TooltipText>Glove Box Door</TooltipText>
    </MouseRect>

Neither of the above attempts worked so I'm sitting scratching my head at the moment and wondering why it doesn't work.

Anyone have any ideas on what I need to do to achieve my goal?
 
Messages
1,049
Country
australia
I'd just put a condition into the mouserect of the glovebox so that the opening of the glovebox was only possible when copilot yoke was not visible (I assume navion_yokecopilot is true when the yoke is visible.

Code:
<CallbackCode>
(L:Navion_YokeCoPilot,bool) !
if{
  (L:glove_box_door, bool) ! (&gt;L:glove_box_door, bool)
}
</CallbackCode>

But there is a problem with this code. If the glove box is open and then yoke becomes visible it becomes impossible to close the glovebox. You can get around this by closing the glovebox yourself when the user makes the yoke visible. Or by using this code which will allow the glove box to be closed even if the yoke is visible. I think this logic is right. Allows the code to only run if the YokeCoPilot is not true or glove box door is true.

Code:
<CallbackCode>
(L:Navion_YokeCoPilot,bool) ! (L:glove_box_door, bool) ||
if{
  (L:glove_box_door, bool) ! (&gt;L:glove_box_door, bool)
}
</CallbackCode>
 
Messages
358
Country
ca-ontario
Thanks Anthony, I think your first code should do the trick and I will test it tomorrow (it's 1 a.m. here now!)

I don't want the glove box to open or close if the yoke is visible as it just looks bad when the door passes through the yoke and vice versa.

In real life you would have to move the yoke out of the way to open the door (unless you were flying straight and level, turning left or climbing).
 
Messages
358
Country
ca-ontario
I've played with your code this morning Anthony and I've finally got it working the way I want with a bit of tweaking. It turns out that my code was opposite to the way you thought (i.e. navion_yokecopilot is false when the yoke is visible) so I had to remove the '!' in your first statement. I then found that if you hid the yoke, opened the door and then displayed the yoke again you would still get interference between the yoke and door. To negate this issue I now have it coded so that if the door is open you cannot 'unhide' the yoke. It works like this:

1. If the yoke is visible you cannot open the glove box door.
2. If the yoke is hidden you can open the glove box door.
3. If the glove box is open you cannot 'unhide' the yoke.
4. If the glove box is closed you can 'unhide' the yoke.

Here is the working code for anyone who has a similar issue at some later date:

Yoke Visibility
Code:
<PartInfo>
    <Name>Navion_hide_copilots_yoke</Name>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Hide Copilot's Yoke (close glove box first)</TooltipText>
            <CallbackCode>
            (L:glove_box_door, bool) !
            if{
            (L:Navion_YokeCoPilot,bool) ! (&gt;L:Navion_YokeCoPilot,bool)
            }
            </CallbackCode>
        </MouseRect>
   </PartInfo>

Glove Box
Code:
<PartInfo>
    <Name>NavA_glove_box_door</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:glove_box_door, bool) 50 *
        </Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <MouseFlags>LeftSingle</MouseFlags>
      <Cursor>Hand</Cursor>
        <CallbackCode>
        (L:Navion_YokeCoPilot,bool)
        if{
        (L:glove_box_door, bool) ! (&gt;L:glove_box_door, bool)
        }
        </CallbackCode>
         <TooltipText>Glove Box Door (hide yoke first)</TooltipText>
    </MouseRect>
  </PartInfo>

Thanks for your help.
 
Messages
1,749
Country
unitedstates
See if this works. All you need is the correct statement in the glove box code. This would auto close the glove box if the user decides to click the yoke while the door was open. Creating statements on both parts may cause a conflict and will make it tougher for the user to rewind the steps.:greenflag




Yoke Visibility
Code:
<PartInfo>
    <Name>Navion_hide_copilots_yoke</Name>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Hide Copilot's Yoke (close glove box first)</TooltipText>
            <CallbackCode>
            (L:Navion_YokeCoPilot,bool) ! (&gt;L:Navion_YokeCoPilot,bool)
            </CallbackCode>
        </MouseRect>
   </PartInfo>


Glove Box
Code:
<PartInfo>
    <Name>NavA_glove_box_door</Name>
    <AnimLength>50</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:glove_box_door, bool) 50 *
        </Code>
        <Lag>100</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <MouseFlags>LeftSingle</MouseFlags>
      <Cursor>Hand</Cursor>
        <CallbackCode>
        (L:Navion_YokeCoPilot,bool) 1 ==
        if{ (L:glove_box_door, bool) ! (&gt;L:glove_box_door, bool) }
        els{ 0 }
        </CallbackCode>
         <TooltipText>Glove Box Door (hide yoke first)</TooltipText>
    </MouseRect>
  </PartInfo>
 
Last edited:
Messages
358
Country
ca-ontario
I tried the code but unfortunately it didn't work. The yoke displays with the door down and the door doesn't close first.
 
Messages
358
Country
ca-ontario
Thanks to Roman (Spokes2112) I now have a nicely animated glove box/yoke combination via a 2D gauge hidden in the VC section of the panel.cfg file. The gauge hides the yoke automatically when the glove box is clicked and re-displays the yoke when the glove box is closed. A very elegant solution to my problem. :)
 
Messages
1,749
Country
unitedstates
Yes i was going to suggest to just write an update code, but figured we could just re write the code above. And that is a great idea to have the yoke auto hide when the glove box is open.:)
 
Top