• 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 Animations and Conditions

Christian Bahr

Resource contributor
Messages
951
Country
germany
Hi!

At this point I would like to share my experiences about animations that can be controlled by conditions. This should only be the beginning, the hope is that many new and good ideas will emerge from it :)

Let's take a hunter's hide as an example. The hunter's hide has two animations: Freeze and Collapse:


3dsm_babylon_animation_groups.jpg


The names of the animations already say it, the hunter's hide should not collapse under Condition A, under Condition B it should collapse. Here is the content of the corresponding XML file, using the bear example from the current MSFS SDK as a template:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<ModelInfo version="1.1" guid="{eca76b2e-3475-4c2f-9bb7-b0901270dbd2}">

<Animation name="Collapse" guid="c4d8867e-9bc1-43f8-80a0-9f7d0b874994" type="Standard" typeParam="random"/>
<Animation name="Freeze" guid="df50f45d-39ba-4f14-8e10-3e5fe8f35992" type="Standard"/>

    <LODS>
        <LOD MinSize="0" ModelFile="ediu_hochsitz.gltf"/>
    </LODS>

<AnimGraph>

        <DefaultState name="Freeze"/>

        <BlendTreeState name="Freeze">
          <Animations>
            <Animation guid="df50f45d-39ba-4f14-8e10-3e5fe8f35992" loop ="True" speed="1"/>
          </Animations>
        </BlendTreeState>       

        <BlendTreeState name="Collapse">
          <Animations>
            <Animation guid="c4d8867e-9bc1-43f8-80a0-9f7d0b874994" threshold="0" loop ="False" speed="0.01"/>
          </Animations>

          <Value>(A:AMBIENT PRECIP STATE, mask)</Value>

        </BlendTreeState>

        <Transition start="Freeze" end ="Collapse">
          <Condition>(A:AMBIENT PRECIP STATE, mask) 3 &gt; if{ 1 } els{ 0 }</Condition>
        </Transition>

        <Transition start="Collapse" end ="Freeze">
          <Condition>(A:AMBIENT PRECIP STATE, mask) 3 &lt; if{ 1 } els{ 0 }</Condition>
        </Transition>

</AnimGraph>
</ModelInfo>

In the flight simulator itself it looks like this, when it rains the hunter's hide collapses, if it doesn't rain then nothing happens:


The next goal would be to figure out how to modify the code to make a proximity detector out of it :)
 
Messages
269
Thanks, Christian.

Have you tried to trigger an animation or a visibility condition by using an Aircaft variable? (A:). I am trying to make a certain model to appear by using transponder code/Nav2 freq/landing light switch, but so far to no avail, while environmental variables seems to work..
 

Christian Bahr

Resource contributor
Messages
951
Country
germany
Have you tried to trigger an animation or a visibility condition by using an Aircaft variable?
I don't know, is an "A" Variable a Aircraft Variable? The code used for this is based on an A variable: (A:AMBIENT PRECIP STATE, mask). This should work with items that should or shouldn't be shown.
However, it is not about the visibility of objects, it is about animations that are triggered by conditions such as rain, for example :)
 
Messages
138
Country
poland
Although it's an Environment variable (E:...) it should be - and as far as I know can only - be called through (A:...).
Proximity triggers: Have been experimenting quite a bit with those, but it seems that they cannot be done within a simobject.
 

Lagaffe

Resource contributor
Messages
860
Country
france
A: variables apply to an aircraft, so something outside the aircraft cannot have these variables.
The E variables are relative to the whole simulator.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,942
Country
us-wisconsin
Avars: actually refers to the SimObject, whether it is an airplane, ground vehicle or hangar. Lvars: are custom variables and if you reference an L:var in a SimObject XML it should read that variable from any SimObject that defined the L:var... for example, an L:var from the user's aircraft can be accessed by an animated hangar door in another SimObject. That's why hidden yoke and taxi lights can be accessed universally by SimObjects if they exist in the user aircraft. E:vars, of course can be accessed by any SimObject's XML, but I believe they are using the environment of the SimObject, not necessarily the environment of the user aircraft. .
 
Messages
76
Country
argentina
Hi, I'm relatively new (and absolutely amateur) doing MSFS development, I am working on a project that includes, among other things, many conditional animations and also related to each other.
I would like to contribute to this forum (which has helped me a lot) with what I have learned, so here are some constructive comments on your code:

Line: "<Animation name="Collapse" guid="c4d8867e-9bc1-43f8-80a0-9f7d0b874994" type="Standard" typeParam="random"/>"
typeParam="random", Is not necessary (although it does not bother that it is there), because your initial animation is a static pose of the object.

Line: "<Animation guid="df50f45d-39ba-4f14-8e10-3e5fe8f35992" loop ="True" speed="1"/>"
It doesn't need to be set to "True", the animation (which I imagine is 1 frame only with the initial pose) will stay that way until you switch to another animation with a transition, you can set it "false".

Line: "<Value>(A:AMBIENT PRECIP STATE, mask)</Value>"
This line (and the "threshold="0") are not necessary, the conditions within a BlendTreeState only make sense if within the group there are more than one animation that must be selected according to a condition, in your case, there is only one animation, so it is the only one that will be selected at the time of transition.

Finally, in the transitions definitions the: "if{ 1 } els{ 0 }", are not necessary either, the direct value of the simvar will generate the transitions.

I understand that my comments are not radical changes, but I think they help to understand the details of the behavior of MSFS in this aspect, which is not very well documented and is quite new.

I hope I'm not wrong in any of the comments (or in all of them!), I make them based on my experience on the subject.

Diego.
 
Messages
76
Country
argentina
Theorizing, I think the problem is that the behavior file (xml) is the same for both, not the data.
The position is data and is independent for each object, but the behavior is code (Logic) and is the same for all.
You should try define several objects each with its XML, you can use a single copy of the object files (gtlf+bin) but not the XML.
D.
 
Messages
54
Country
spain
Very sad to ear that... I don't want more files!! hehe Because when the aircraft uses added liveries, we are not able to pack more model.number/model.xml at the same aircraft.cfg and I would need to create a copy of that livery with the alternative behavior file :(

Well, I have tried it, it's an engine limitation.

Gracias!
 
Messages
76
Country
argentina
Remember, I'm just theorizing, maybe I'm wrong and there is a way.
Do not give up. ;)

Si puedo ayudar con el proyecto, manda PM.

D.
 

=rk=

Resource contributor
Messages
4,461
Country
us-washington
No it's a known limitation of the sim, we're getting too sophisticated. If the models aren't overly complex, you can simply make new distinct variations of them with unique GUID's and those will act independently. Also, if you invite living AI to your parking, as opposed to placed SimObjects, those also act independently. So, this raises the possibility of having SimObject AI, your own models, but independently operating and even taxiing and flying. These below were made by using the animated parts of default Asobo models to make flying AI.

thumbnail.jpg


j20thumbnail.jpg

These are included in my most recent project linked in my sig below and they are flyable, although there is no cockpit, of course.
 
Messages
54
Country
spain
Don't tell me why but using the units "degree latitude" and "degree longitude" instead of radians, every spawned AI object, yes reads the code individually 😄

XML:
(A:PLANE LATITUDE, degree latitude) (A:PLANE LONGITUDE, degree longitude) % 5 symb 4 >
This returns 0 o or 1 depending the spawned AI plane position, so the door will be open or closed individually each stationary plane 😍
Maybe this is useful for static objects too.

Thanks all for the help.
 
Last edited:
Messages
76
Country
argentina
WAAAATTTTT???????? 😵‍💫😵, that doesn't make any sense!!!

Anyway, happy because you didn't give up!! ;)
 
Top