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.
Check camera state simvar
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”.
And it is the same for all other camera variables, including camera substate.
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
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.