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

MSFS20 Animation dependent on distance from user aircraft?

Messages
293
Country
germany
Hi, does anybody know if there is an easy way to make an animation play once the user gets close enough to the animated object? Up until now I was able to create looping animations and I also created some Simobjects which are only visible under certain conditions (time of day, month, weather....). What I want to do now is an animation that starts as soon as the user is less then about 500 feet away and then play only once. Is there a parameter I can use in the xml or does it require more complex programming?

Thanks and cheers, Fabian
 
Have you looked at SODE ? I believe that can do things like open hangar doors when you get near.

 
Oh sorry, I forgot to mention that it's for MSFS. In P3D SODE would surely be the best way to do something like this.
 
First off, the object would need to be a SimObject. Then I think a clue would be found in the animation.xml of the Mashaller SimObject. For example I see:

XML:
            <Transition name="StandBy to MoveAhead" start="StandBy" end ="MoveAhead" duration="0.5">
              <Condition>              
                (A:MARSHALLER AIRCRAFT DISTANCE DIRECTION Z PARKINGSPACE, METERS) 150 &lt;
                (A:MARSHALLER AIRCRAFT DISTANCE DIRECTION Z PARKINGSPACE, METERS) 100 &gt;
                (A:MARSHALLER AIRCRAFT DISTANCE DIRECTION X PARKINGSPACE, METERS) abs 25 &lt;
                (A:MARSHALLER AIRCRAFT HEADING PARKINGSPACE, DEGREES) abs 95 &lt;
                and
                and
                and

Obviously, the Marshaller is reacting to the distance and heading of the AIRCRAFT. I would think this is where the testing should start.
 
First off, the object would need to be a SimObject. Then I think a clue would be found in the animation.xml of the Mashaller SimObject. For example I see:

XML:
            <Transition name="StandBy to MoveAhead" start="StandBy" end ="MoveAhead" duration="0.5">
              <Condition>            
                (A:MARSHALLER AIRCRAFT DISTANCE DIRECTION Z PARKINGSPACE, METERS) 150 &lt;
                (A:MARSHALLER AIRCRAFT DISTANCE DIRECTION Z PARKINGSPACE, METERS) 100 &gt;
                (A:MARSHALLER AIRCRAFT DISTANCE DIRECTION X PARKINGSPACE, METERS) abs 25 &lt;
                (A:MARSHALLER AIRCRAFT HEADING PARKINGSPACE, DEGREES) abs 95 &lt;
                and
                and
                and

Obviously, the Marshaller is reacting to the distance and heading of the AIRCRAFT. I would think this is where the testing should start.
That´s a good idea, I know some developers use the Marshaller SimObject to "fake" a VGDS. Maybe I can do somethiung similar. I only wish I had more knowledge in coding, most of these conditional variable things I do is trial and error...Can you tell me the location of the above xml so I can have a look?

Thanks, Fabian
 
That´s a good idea, I know some developers use the Marshaller SimObject to "fake" a VGDS. Maybe I can do somethiung similar. I only wish I had more knowledge in coding, most of these conditional variable things I do is trial and error...Can you tell me the location of the above xml so I can have a look?

Thanks, Fabian
Look in the official folder .....\asobo-simobjects-characters\SimObjects\Humans\Marshaller
 
Hi,

is it currently possible to stop an animation when your own aircraft is nearby?
There are animated cranes on a platform. When a helicopter approaches to land on the platform's helipad, the cranes should not move. If the helicopter flies away, the animation of the cranes starts again.

Is this possible? If so, what would a formula look like?
 
Hi Chris, you can try with this approach (worldscript based)

 
Thanks, but it's not what I need :)

The crane animation has already started. It should stop when my helicopter approaches the oil platform. Is there a solution to this?
 
There is a solution if your crane models are SimObjects that you have placed as part of a scenery, in which case there are probably a few ways. The easiest of course being the "conceal joystick animation trigger:"
XML:
    <PartInfo>
        <Name>*ANIMATION_NAME*</Name>
        <AnimLength>400</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                (L:XMLVAR_YokeHidden1) 1 == if{ 400 } els{ 0 }
                </Code>
                <Lag>10</Lag>
            </Parameter>
        </Animation>
    </PartInfo>


I think the easiest way to set it up is to have the crane animation loop with a pause at the beginning suitable for a landing. As you approach you trigger it to start and then land. You could probably get more elegant using SimConnect and/or some Template magic to change their animation state. For example, instead of interrupting the looping animation, you could have two complementary animation states, one of them has the cranes idle for the landing and your joystick Template or whatever you use to trigger switches between them. As to "hijacking" existing scenery cranes, I suppose you could write an edited "addon" Package of the particular scenery using the same tricks above.
 
The idea with the pause in the animation is a good idea, but could possibly be used elsewhere 👍

I don't want to open and edit the 3D model again. The most elegant solution would be to add code to the XML file, like we do with the visibility code... but the code should control the animation.

... maybe the idea was too simple.

But okay, I thought someone had already figured it out. It's not a drama 🙂

EDIT
The solution with the yoke could really help me, let's see ;)
 
I just think I made a mistake in my thinking. It probably doesn't work as easily as I imagined. So I reject my idea (for now).
Nevertheless, thank you very much for your answers :)
 
Back
Top