• 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 How to create Switches and Handles in Cockpit

Messages
33
Country
germany
Hello everybody

Does somebody has any idea why this animation of the switch does not the complete 100 keyframes in MSFS?
This animation makes only the first step of the 100 Blender keyframes.
If I change the <ANIM_LENGTH> from 100 to 1 in the xml-file, the switch makes the full way, but it is making only two steps then, up and down.
So it looks not like a nice, soft animation.
How can I make it going through the hole 100 Keyframes?

Here is the xml-file and the Blender screenshot:
1622377771971.png

1622377986936.png


Thanks a lot to all of you.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
You need to add a space between 100 and the multiplication symbol:

100 *</ANIM_CODE>

Proper spaces are required!
 
Messages
33
Country
germany
Thank you, now it is working the complete way :)
The only thing is, that it moves very fast. You do not see the switch moving.
Can I turn the speed of the animation down, to make it slower?
 
Messages
94
<ANIM_LAG>100</ANIM_LAG> is what sets the speed of animation. Higher numbers seem to slow it down. Try 100, 200 or 300 to see what you like.
 
Messages
33
Country
germany
Hello sal1800,

thanks al lot, it worked fine. Now I can tune the speed as I like it.
In my animation, higher numbers makes it faster ... But it's OK, it works ! :)

Again thank you so much for your help.
 
Messages
33
Country
germany
Hello everybody,
I tried to make the Trim-Lever of my K7-Glider, but I have a little problem there:
The trim-rudder at the elevator is working fine, but in the cockpit, when i got 50% of the trim-range (in the middle of it), my trim-lever stays at the full-forward-position,
and its going full back, when I trim full up. If I trim down, the lever isn't moving, because it is already in the full-down-position. Can someone please help me to fix this ?
Here are some screenshots:

Middle position
1622939478209.png
1622939517309.png


Full_Up_position
1622939596571.png
1622939622900.png


Full_Down_position
1622939717631.png
1622939750523.png


Here is the .xml-file for the Trim-Lever:

1622939828300.png


and here the Blender-screenshot:

1622939994079.png


Thank you so much for any help.
 
Messages
94
Everything looks ok how you have set it up, so the next thing you need to look at is the current value of ELEVATOR TRIM PCT. In dev mode, open the model behavior debug window and select your model and you can select the component to inspect. There is a logging section that displays the values you are using in your XML code.

I looked at Asobo's version of the elevator trim and they use this code:
Code:
<ANIM_LENGTH>200</ANIM_LENGTH>
<ANIM_CODE>(A:ELEVATOR TRIM PCT, Percent) 100 +</ANIM_CODE>

That would imply to me that ELEVATOR TRIM PCT may be in the range of -100 to 100 instead of 0 to 100. I haven't checked it in sim yet. You always need to confirm that the value that the code line generates corresponds to the range of your animation keyframes.
 
Messages
33
Country
germany
OK, thanks a lot.
I did only a quik test, because I had not so much time...

I have changed the animation in Blender to a length of 200 keyframes.
In the xml, first I tried this one:
1623096354325.png

The lever was moving like before, nothing has changed.
... then I tried this one:
1623096638002.png

The lever wasn't moving anymore.
What can be wrong?
 
Messages
2,077
Country
us-ohio
Go back to your original code. I'll say this again... the elevator trim has both a positive and a negative value. So... your animation isn't reacting to it being negative. Your animation is only reacting to its positive values.

+100%....0%....-100%
 
Messages
33
Country
germany
Hello WarpD,

thanks for your help.
So do I have to change the animation in Blender?
Simply move the keyframes half positive and half negative?
... sorry, but I am new in creating planes, and I like to learn it ...
 
Last edited:
Messages
33
Country
germany
OK, I tried it with moving keyframes in Blender to the negativ.
I now got 50 frames neagtive and 50 in the positive area.
1623119668369.png

the xml-file is:
1623119754150.png


But it wont work, I got the same result...:(
 
Messages
94
So the template you're using ends up calling ASOBO_GT_Sim_Base which doesn't use <ANIM_CODE>. But there are some additional parameters that can help.

You can add <ANIM_SIMVAR_BIAS>100</ANIM_SIMVAR_BIAS> which should basically add 100 to all the simvar values which removes the negative numbers. Then you should be able to add <ANIM_LENGTH>200</ANIM_LENGTH> and increase the animation in Blender to 200 frames.

That's the way this kind of development goes. Sometimes you think it should be simple and the sim throws you a curveball.

I find it helpful to look at the Asobo templates and in many cases, use them as is. The Elevator trim in particular is more complex than you would initially think. So if someone else already dealt with all that, it makes sense to use it.

This is part of the template from the Asobo elevator trim. It uses a different lever template that calls the event set instead of increment and decrement. I added in your animation name and tooltip. Untested, but I think it's right.

Code:
<UseTemplate Name="ASOBO_GT_Lever_DraggingYAxis_EventsSet">
  <ANIM_NAME>ELEV_TRIM_UP_DOWN</ANIM_NAME>
  <TOOLTIPID>Elevator TRIM UP/DOWN</TOOLTIPID>
  <ANIM_LENGTH>200</ANIM_LENGTH>
  <ANIM_CODE>(A:ELEVATOR TRIM PCT, Percent) 100 +</ANIM_CODE>
  <DRAG_SIMVAR>ELEVATOR TRIM PCT</DRAG_SIMVAR>
  <DRAG_SIMVAR_UNITS>percent</DRAG_SIMVAR_UNITS>
  <DRAG_EVENTID_SET>ELEVATOR_TRIM_SET</DRAG_EVENTID_SET>
 </UseTemplate>
 
Messages
33
Country
germany
Hi sal1800,
thank you so much, it is working great ! :)
I only add the line with BIAS 100 and LEGNTH 200, and it worked.
But I will try the other template too, next time.
You are a real specialist in creating planes...👍
Thanks again.
Now I can make the levers more realistic and more beautiful, because I know, they are working...:)

This is a great forum, till now I've learned so much...
Thanks to all.
 
Messages
33
Country
germany
Hi Guys,
again I got a question:
Why is the parameter for the animation-speed "<ANIM_LAG>50</ANIM_LAG>" in this examble not working?

1625767710080.png


No matter, what parameter I use here, it always give's the same result.
Does anyone have an idea?

Thanks for any help.
 

Attachments

  • 1625767638640.png
    1625767638640.png
    21.9 KB · Views: 98

Lagaffe

Resource contributor
Messages
857
Country
france
Simply because it is not the good tag. The right code is (Legacy code and not ModelBehaviours):
<Lag>50</Lag>
 
Messages
33
Country
germany
Hi Lagaffe,

thank you so much for your answer, now it works great.
With an parameter of <LAG>30</LAG> the animation got the wright speed, like I want it.

Thank you very much. :)
 
Messages
19
Country
unitedkingdom
is it possible to reference and play a sound directly from this xml code? (such as the lever squeaking) in this case?
 
Messages
13
Country
unitedstates
Sounds are specified in sounds.xml and are referencing specific nodes and SimVar. That's all I can say now as I'm still working on animating the exterior and still use a sound pack from Cessna 172 that works fine when using Asobo templates for animations. Take a look at sounds.xml for Asobo planes, you might find a code you need there.
 
Top