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

MSFS Using Camera State and NodesToHide to hide pilots and passengers

Messages
646
Country
australia
I am a lazy bugger so the thought of creating and maintaining separate interior and exterior aircraft models does not appeal to me. I like to create a single model and use the view to make things visible or not. In FSX and P3D the only way to do this is using simconnect to capture the camera state and even that is limited.

MSFS adds a couple of new A: variables (which are undocumented) and changes to the camera.cfg that make it possible to do this without using simconnect.

First the A: variables:

A:CAMERA STATE will return the camera state. There are various values and the ones listed below are the ones I have found so far. There may be more. Particularly with those above 10 which seem to be related to the UI menu system which I haven't fully explored. 2 to 5 seem to be the only ones used in game.

2 virtual cockpit
3 External (camera substate 1)
4 Showcase - Drone (camera substate 0)
5 Showcase - Fixed External (camera substate 0)

10 Flight loading
11 World Map
13 Welcome page

A:CAMERA SUBSTATE this only seems to useful in the virtual cockpit (CAMERA STATE == 2)

1 Pilot views
3 Quickviews
5 Instrument views

Second the cameras.cfg:

NodesToHide is a new parameter in the cameras.cfg. Despite the name this is not a model node. It is a reference to an L: var. If there is an L: var listed in NodesToHide then MSFS will make that variable true when the view is active and false when it is not. Note, this only seems to work on cameras defined in the cameras.cfg. If you use an external or drone view then the L: var will not change.

For example, in the DA40 the instrument views use NodesToHide to hide the Yokes so they aren't in the way when viewing the instruments. The entry lists two L: vars separated by a space:

NodesToHide ="XMLVAR_YokeHidden1 XMLVAR_YokeHidden2"

The user interaction of the model will also hide the yokes using the same variable names (L:XMLVAR_YokeHidden1) and (L:XMLVAR_YokeHidden2). Note the XMLVAR seems to be used by the developers as a naming convention and is not a necessary part of the syntax to make it an L: var.

Putting them together:
CAMERA SUBSTATE has very little practical use. It only seems to be useful when using the virtual cockpit and those views can be covered using NodesToHide in the cameras.cfg

Using NodesToHide is most commonly used to hide yokes/joysticks but you could use it for an engine view to automatically open an engine door. The parameter switches an L: var between true (when the view is active) and false (when the view is switched to another in the cameras.cfg). There is nothing that says you have to use that L:var for visibility. You can use it for anything that you wish.

You can also use NodesToHide to hide the visibility of pilots and passengers. The aircraft I am working on at the moment has pilot and passenger in line (rather than side by side) so the passenger is usually visible in the virtual cockpit view but if the user switches to the passenger view I want the pilot to become visible and to hide the passenger. However, if they switch to an external view I want the pilot and passenger to be both visible (remember I am using a single model for interior and exterior views, it really does save a lot of work). The NodesToHide system does not work in this situation as it will only change the values of the L:vars if you switch to a defined camera in the cameras.cfg. As the exterior and drone cameras are not defined the L:var does not change. So I use the CAMERA STATE to check if we are in the virtual cockpit or not. A simple check in the model behaviors file can then be used to check the view state and adjust visibility of the pilot and passenger models.
 

Christian Bahr

Resource contributor
Messages
846
Country
germany
The user interaction of the model will also hide the yokes using the same variable names (L:XMLVAR_YokeHidden1) and (L:XMLVAR_YokeHidden2). Note the XMLVAR seems to be used by the developers as a naming convention and is not a necessary part of the syntax to make it an L: var.
Hi.

That seems to be a very interesting place here when you can start an animation using code. At the moment I'm experimenting with a code that makes an SimObject appear under certain conditions and starts an animation: namely the time and the weather. The code is largely based on the example of the resource from @rhumbaflappy MSFS Simple Animated Hangar

The slightly modified code looks like this:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{a9cdb5b0-3571-48e3-91d7-49f56482c7d1}">

<LODS>
<LOD minSize="0" ModelFile="ediu_living_people_frau.gltf"/>
</LODS>

<Animation guid="f95e5499-1a71-48b5-aad7-625c46e236e2" length="800" name="ediu_living_people_frau" type="Sim" typeParam="AutoPlay" typeparam2="ediu_living_people_frau"/>

<AnimGraph>
<DefaultState name="Frau_Animation"/>
<BlendTreeState name="Frau_Animation">
<Animations>
<Animation guid="f95e5499-1a71-48b5-aad7-625c46e236e2" loop="True" speed="1"/>
</Animations>
</BlendTreeState>
</AnimGraph>

<PartInfo>
<Name>ediu_living_people_frau</Name>
<AnimLength>800</AnimLength>
<Animation>
<Parameter>
<Code>(E:LOCAL TIME, Seconds) 43200 &gt;= (E:LOCAL TIME, Seconds) 46800 &lt;= if{ 1 } els{ 0 }</Code>
<Lag>80</Lag>
</Parameter>
</Animation>
</PartInfo>

</ModelInfo>

<ModelBehaviors>

        <Component ID="Frau" Node="ediu_frau">
            <Visibility>
                <Parameter>
                    <Code>(E:LOCAL TIME, Seconds) 32400 &gt;= (E:LOCAL TIME, Seconds) 54000 &lt;= and (A:AMBIENT PRECIP STATE, mask) 3.0 &lt; and if{ 1 } els{ 0 }</Code>
                </Parameter>
            </Visibility>
        </Component>

</ModelBehaviors>

But unfortunately the Animation Code doesn't work and it seems to be due to the variable "E: LOCAL TIME". Because if I take the variable "L: XMLVAR_YokeHidden1" from Dick's Simple Hangar, then everything works as it should: The figure is displayed during the visibility time set below and the animation starts when I hide the yoke in the Cessna 152 Cockpit.

The question that logically arises here is whether there are more of these "L: XMLVAR_xxx" variables and where you can look them up in the SDK. Am I guessing correctly that this is a "Simconnect variable"?
 
Messages
646
Country
australia
The question that logically arises here is whether there are more of these "L: XMLVAR_xxx" variables and where you can look them up in the SDK. Am I guessing correctly that this is a "Simconnect variable"?

L:XMLVAR is a naming convention used by ASOBO. There is no such thing as L:XMLVAR variables because they are simply L: variables which are standard user variables used in XML code for MSFS and FSX. You could change the XMLVAR to whatever you like and it would still work. They are definitely not simconnect variables.

I don't know why E:Local time isn't working. The only two things I could suggest are using P:Local Time (I've seen ASOBO use the P: variable type instead of E: before) or simplify the parameters so you are only checking one local time condition. The only other thing would be to monitor the local time values which it doesn't seem like you can do with the simvars program. You could add something like (E:LOCAL TIME, Seconds) (&gt;L:LocalTimeRecord,number) to your code and then save the flight. L: variables are saved as part of the save flight so you can check the value by loading the saved flight in a text editor.
 

Christian Bahr

Resource contributor
Messages
846
Country
germany
The strange thing is that the "<ModelBehaviors>" section works just fine. But the section for the start of the animation seems to be tricky. I just don't know enough about it. Let's see how we can find a solution, at least thank you for your answer.
 
Messages
558
Country
france
Hello,

Indeed, I just noticed that this variable was available via the SimVars program, as well as others of the same type: CAMERA REQUEST ACTION for exemple.

In the same way, I was looking for a way to determine with a variable if the plane was on a RUNWAY, a PARKING, an APRON, in a HAnGAR or if it was CLIMBING, CRUISING or in APPROACH.
This type of variable should exist because of the existence of FLT files with these names (runway.flt).

As I understand theses principles, the system must react according to these variables, call the right FLT and thus be able to position the state of the plane which is described in the FLT

According theses undocumented variables, it should be possible to launch the simulator in a determined situation on a runway but in cold & dark for exemple and not with a motor running.
 
Messages
646
Country
australia
Hello,

Indeed, I just noticed that this variable was available via the SimVars program, as well as others of the same type: CAMERA REQUEST ACTION for exemple.

In the same way, I was looking for a way to determine with a variable if the plane was on a RUNWAY, a PARKING, an APRON, in a HAnGAR or if it was CLIMBING, CRUISING or in APPROACH.
This type of variable should exist because of the existence of FLT files with these names (runway.flt).

As I understand theses principles, the system must react according to these variables, call the right FLT and thus be able to position the state of the plane which is described in the FLT

According theses undocumented variables, it should be possible to launch the simulator in a determined situation on a runway but in cold & dark for exemple and not with a motor running.
Those additional FLT files are usually called with mission files

[Sim.0]
Sim=TBM 930 Asobo
SimFile=final.FLT

The above is from the nassau landing mission. It gives the Sim model and the FLT file to load. Approach, climb and cruise are likely called in the same way by directly referencing the file name in the mission file.

I presume MSFS loads runway.FLT if you have selected a runway as the start point for the flight and apron.FLT if you select a parking spot.
 
Top