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

ericmarciano avatar image
ericmarciano asked ericmarciano answered

Detecting pre-flight animation

Is there a way to detect the pre-flight animation in JS code?

What I call the "pre-flight animation" is when the aircraft moves by itself before you click "ready to fly", especially in case you selected a runway for takeoff, which means the aircraft is positioned on the runway, ready for take off.

This is important for me because when I click "ready to fly", the aircraft is positioned on the runway threshold a few feet above the ground before touching the ground. Consequently, me FMC understands this sequence as aircraft in flight followed by aircraft on ground, which means the aircraft has landed, obviously wrong... So if I could detect this sim pre-flight phase, that would help (also for some other reasons).

Thanks.

gauges
10 |10000

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

Crocket avatar image
Crocket answered

Check camera state simvar ;)

10 |10000

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

ericmarciano avatar image
ericmarciano answered ericmarciano commented

I wish it did the trick, but it doesn't. As soon as the flight starts, the camera state is 2 (cockpit) and does not change between the pre-flight animation and the actual flight. In other words, the camera state does not change when you press "ready to fly".

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.

ericmarciano avatar image ericmarciano commented ·
And it is the same for all other camera variables, including camera substate.
0 Likes 0 ·
Yoanito avatar image
Yoanito answered

Hello @ericmarciano,

Unfortunately there is no way to check if you are in this pre-flight state but for the flights where the aircraft is moving on his own to a runway you can check the "AI CONTROLS" Simvar wich will be at 1 during the pre-flight and will switch to 0 if you hit "ready to fly".

But i think the main issue here is the fact that your aircraft is detected as in the air during this pre-flight phase, is it a custom aircraft ? And if yes are you sure your contact point are at the right spot ?
If you use SimVar Watcher and watch the "CONTACT POINT IS ON GROUND" variable it should be at 1 during the pre-flight animation and stay at 1 if you hit "ready to fly".

Best Regards,
Yohan

10 |10000

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

ericmarciano avatar image
ericmarciano answered

Yes, indeed it is a custom aircraft. The problem is not the aircraft being in air during the pre-flight cinematic, the problem is that when I start the flight, the aircraft spawns at the runway threshold a few feet above the ground, then falls on the ground afterwards. I asked the person in charge to check the contact points.

In the meantime I found another way to detect if the flight has really started, after pressing the "ready to fly" button : the "onStarted" function of my instrument is invoked, I just have to place the right code in there.

10 |10000

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

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.