plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

FlyingRaccoon avatar image
FlyingRaccoon asked Gobby commented

Triggering Hangar Door Animation Using SimVar

Hi,
is there any way to trigger animation using SimVar such as:
(A:LIGHT NAV ON, Bool).
The idea is to start the hangar Open animation door when the NAV LIGHT is set to ON and trigger the Close Animation when the NAV LIGHT is set to OFF.

I’ve never tried to use SimVar, so I may have done stupid stuff.
I’ve written some code, but it hasn’t been working so far, can anybody help me?


<?xml version="1.0" encoding="utf-8"?>

<Animation name="LKPR_Door_Default" guid="dc71896e-6cf7-4740-9f22-7e5a1b008a9f" length="2" name="LKPR_Door_Default" type="Sim" typeParam="AutoPlay" typeParam2="LKPR_Door_Default" />
<Animation name="LKPR_Door_Open" guid="337194ad-0345-4907-9c59-ec2be2511620" length="900" name="LKPR_Door_Open" type="Sim" typeParam="AutoPlay" typeParam2="LKPR_Door_Open" />
<Animation name="LKPR_Door_Closed" guid="b9b5e1d3-c686-4791-8b5d-45595938ffc3" length="900" name="LKPR_Door_Closed" type="Sim" typeParam="AutoPlay" typeParam2="LKPR_Door_Closed" />

<AnimGraph> 
   <DefaultState name="LKPR_Door_Default"/>
   <BlendTreeState name="LKPR_Door_Default">
     <Animations>  
       <Animation guid="dc71896e-6cf7-4740-9f22-7e5a1b008a9f" loop ="True" speed="1" />
       <Animation guid="337194ad-0345-4907-9c59-ec2be2511620" loop ="True" speed="1" />
       <Animation guid="b9b5e1d3-c686-4791-8b5d-45595938ffc3" loop ="True" speed="1" />
     </Animations>
   </BlendTreeState>
</AnimGraph>

<PartInfo>
   <Name>LKPR_Door_Open</Name>
   <AnimLength>900</AnimLength>
   <Animation>
      <Parameter>
         <Code>(A:LIGHT NAV ON, Bool) 0</Code>
      </Parameter>
   </Animation>
</PartInfo>


<?xml version="1.0" encoding="utf-8"?>

<Animation name="door1" guid="337194ad-0345-4907-9c59-ec2be2511620" type="Standard" />
<Animation name="door2" guid="b9b5e1d3-c686-4791-8b5d-45595938ffc3" type="Standard" />

<AnimGraph> 
   <DefaultState name="Anim"/>
   <BlendTreeState name="Anim">
   <Animations>  
      <Animation guid="337194ad-0345-4907-9c59-ec2be2511620" loop ="True" speed="1" threshold="0"/>
      <Animation guid="b9b5e1d3-c686-4791-8b5d-45595938ffc3" loop ="True" speed="1" threshold="0"/>
   </Animations>
   <Value>(A:LIGHT NAV ON, Bool)</Value>
</AnimGraph>

This kind of approach worked, but it only trigger the animation ONCE, if I use the loop=True it never stops, otherwise it only gets called once.

aircraftanimation
1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

1 Answer

·
FlyingRaccoon avatar image
FlyingRaccoon answered Gobby commented

@Tailstrike1085, the original poster on MSFS forums


- You should only have one animation for your hangar door, not 3. Just have you door closed at frame 0 and opened at frame 900

- If you want to use the LIGHT NAV ON boolean to control the animation, the code must be (A:LIGHT NAV ON, Bool) 900 * to match you animation length

Regards,
Sylvain

3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

rhumbaflappy avatar image rhumbaflappy commented ·
A better idea might be to allow a hangar door to animate by aircraft proximity to the door, for example at 50 meter distance and heading between -60 and 60 degrees from the face of the door.

This could then also be used to trigger lighting, or any animation or visibility.


0 Likes 0 ·
WildLynxAir avatar image WildLynxAir rhumbaflappy commented ·
What would be the code needed to make this happen (using the proximity as trigger)?
0 Likes 0 ·
Gobby avatar image Gobby WildLynxAir commented ·
I'd also love to see any example of the code required for proximity triggers. I've seen it done, but haven't found a way of making it work yet.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.