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

FSXA help creating xml code for groundspeed based animation

Messages
228
Country
australia
As the title says, I need some assistance with xml code for a part that will animate between 10 and 100 knots. I am creating a light business jet and in all videos I have seen, during taxi and takeoff, the aircraft wobbles very snappily from side to side and I would like to implement this wobble.

I am no hand at xml so what I have so far (hashed together) is:

<PartInfo>
<Name>TJ_vib</Name>
<AnimLength>100</AnimLength>
<Visibility>
<Parameter>
<Code>
(A:VELOCITY BODY Z, feet) 169 - 17 &lt;; if{ 0 } els{ 1 }
</Code>
</Parameter>
</Visibility>
<Animation>
<Parameter>
<Sim>
<Variable>CENTER WHEEL ROTATION ANGLE</Variable>
</Sim>
</Parameter>
</Animation>
</PartInfo>

but I'm sure you kind people will point out my error(s).
Any assistance would be greatly appreciated.
Thanks.
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
What your code does is making the part invisible if the speed is outside the specified range. That's what the visibility tag actually does, the description in the sdk doc is a bit confusing indeed.
btw using the wheel rotation angle is a cool idea.

Try something like this:

Code:
<PartInfo>
   <Name>TJ_vib</Name>
   <AnimLength>100</AnimLength>
   <Animation>
         <Parameter>
                <Code>
                       (A:Sim On Ground, bool) 1 ==  (A:Ground Velocity, knots) 10 &gt;= && (A:Ground Velocity, knots) 100 &lt;= && if{ (A:Center Wheel Rotation Angle, radians) 15.9155 * } els{ 0 }
                </Code>
                <Lag>800</Lag>
         </Parameter>
  </Animation>
</PartInfo>
 
Messages
228
Country
australia
Thank you so much for the speedy reply. I'm away from my computer for a while. Will try it out as soon as I get back and report.

Regards, TJ
 
Messages
228
Country
australia
Don't know what I did wrong but that code caused a failure to load the modeldef file into 3dsMax. Any ideas?
 
Last edited:

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
Did you copy that exact code? You might have to check the syntax because I was a bit careless there.
 
Messages
228
Country
australia
Copied and pasted. I have no real knowledge of xml syntax so wouldn't be able to spot a mistake if there was one. Must admit I have never had that happen to me before. A few more grey hairs for me. Have to look at buying shares in a hair dye company. Lol.
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
I just checked I always used "and" instead of "&&".
Also Blender refuses my modeldef.xml when I change this.

So the code should say:

Code:
(A:Sim On Ground, bool) 1 ==  (A:Ground Velocity, knots) 10 &gt;= and (A:Ground Velocity, knots) 100 &lt;= and if{ (A:Center Wheel Rotation Angle, radians) 15.9155 * } els{ 0 }
 
Messages
228
Country
australia
SUCCESS!!!!!!!!!!!!!!!
It worked with one small change..

<Animation name="TJ_vib" guid="DD403C5C-A751-440b-BFD7-027D2431FD97" length="200" type="Sim" typeparam2="TJ_vib" typeparam="AutoPlay" />


<PartInfo>
<Name>TJ_vib</Name>
<AnimLength>100</AnimLength>
<Animation>
<Parameter>
<Code>
(A:Sim On Ground, bool) 1 == (A:Ground Velocity, knots) 10 &gt; &amp;&amp;
(A:Ground Velocity, knots) 100 &lt; &amp;&amp; if{ (A:Center Wheel Rotation Angle, radians) 15.9155 * } els{ 0 }
</Code>
<Lag>800</Lag>
</Parameter>
</Animation>
</PartInfo>


Thank you, Oh thank you.....Just gave the Missus a rare fright with the scream of joy I let out.
She is shaking her head at the moment....guess partners will never understand our hobby

Thank you again. You are a LEGEND sir..
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
Glad you got it working :)


just something I noticed: How long is the animation after all?
In the "headline" it says 200 but the AnimLength teg says 100 :confused:
 
Messages
228
Country
australia
Should have read 200 for both. Figured that out later. Sorry.
One more question, after a bit of testing, I notice that the vibration speeds up with velocity which is logical as this is what we asked it to do. Is there any way to eliminate this because the wobble is negligible understandably and as speed increases, it becomes almost invisible. I would like the wobble to be of a constant frequency so I could control its existence via animation alone.
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
In that case you need to invent you own variable instead of using the wheel angle for the animation to follow. You can do that ba simply defining an L:var.

Something like this should work:

Code:
(A:Sim On Ground, bool) 1 ==  (A:Ground Velocity, knots) 10 &gt;= and (A:Ground Velocity, knots) 100 &lt;= and (L:wobble state, number) 0 != || if{ (L:wobble state, number) 2.0 * + 200 % d (&gt;L:wobble state, number) }

Note that when out of speed bounds this animation will continue until it reaches its rest position.
The speed can be tweaked via the 2.0 value.
The animation speed will also depend on FPS as this code updates itself each frame.

Hope this helps
 
Messages
228
Country
australia
Hi Dave, I'm going to be a pain and ask for some more help. I'm going to try a different approach this time as while your code works perfectly, the resulting animation I asked for is not the one I want as it speeds up the vibration which I don't want and as I am such a newbie, I cannot get my head around your suggested code with my own variable. So is it at all possible to redo the code but this time using the SMOKE ENABLE variable instead of the Center Wheel Rotation Angle one that we initially used. I will then be in familiar territory as I think I can manipulate a xml gauge that I have to control the existence of the wobble and if I am thinking straight, the vibration won't increase with speed.
Please tell me if my thought process makes no sense at all.

Thanks sincerely in advance,
TJ
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
Using the SMOKE ENABLE to control the animation will not work as the animation would be played when you turn the smoke on and played back when you turn it off. Would make sense for a smoke switch insidethe cockpit.
So basically the output value of the script should not be if the animation plays at all but the frame the animation should be at.

What you need as far as I undersood is a looping animation so you need an output value that loops too. That's done by the wheel angle which depends on speed but also by my custom variable and the code around.
I also made the wipers of my CRJ with a custom looping variable, but of course with other playing conditions.
 
Messages
228
Country
australia
Just tested that and you are absolutely correct. But I cant seem to put your code together somehow. This is what I have in the modeldef so far but nothing seems to work

Code:
<PartInfo>
   <Name>TJ_vib2</Name>
   <AnimLength>200</AnimLength>
   <Animation>
         <Parameter>
                <Code>
        (A:Sim On Ground, bool) 1 ==  (A:Ground Velocity, knots) 5 &gt;= and (A:Ground Velocity, knots) 20 &lt;= and (L:wobble state, number) 0 != || if{ (L:wobble state, number) 2.0 * + 200 % d (&gt;L:wobble state, number) }
                </Code>
                <Lag>800</Lag>
         </Parameter>
  </Animation>
</PartInfo>

Can I please ask you to cast a critical eye over my work for any syntax error. Much appreciated.:)
I'm off to bed now, will check back in the morning. Thanks again.
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
I just kopied your code into my modeldef.xml to test it and it is properly loaded and can be assigned.

Sadly I just noticed that the most recent Blender exporter does not seem to export the animations correctly so my plane does not animate at the moment and I can't check if the code does what it should.

I have to sort that out first.
 

dave hoeffgen

Resource contributor
Messages
1,439
Country
germany
OK I kind of sorted it out and got the animations working again.

There was indeed a syntax error within the postfix maths inside the if statement.

Code:
(A:Sim On Ground, bool) 1 ==  (A:Ground Velocity, knots) 5 &gt;= and (A:Ground Velocity, knots) 20 &lt;= and (L:wobble state, number) 0 != || if{ (L:wobble state, number) 2.0 + 200 % d (&gt;L:wobble state, number) }

This should work.

BTW the LAG entry does no longer make sense so it can be removed.
 
Messages
228
Country
australia
You legend that worked perfectly!!!!
now I have better control over the animation. Thank you so much for your help on this one.

Just on a side note, While taking the aircraft for a test spin, I accidentally went on an off runway excursion. During this, I noticed her bouncing on the rough surface very gently which from the videos I have seen is the exact same motion she makes while on the takeoff roll. Might you know of any way of simulating this bounce at all?

Once again, Many many thanks for your help on the Wobble.
Kind regards
TJ
 
Top