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

modeldef.xml code problem

Dietmar

Resource contributor
Messages
198
Country
germany
Dear all,

I have a flying GMAX model which includes a rotating disk. The model works fine and the disk from the model rotated as well in FSX.
Now I want to stop the rotation depending on the sim variable "GENERAL ENG RPM ". Means, the rotation shall stop if the rpm value moves to zero.
The new code I inserted in the modeldef.xml file is this:

<Animation name="engine0_turning" guid="{EDED46CC-34EC-4a09-8E0E-937964751DC4}" length="100" type="Sim" typeParam2="engine0_turning"
typeParam="AutoPlay" />

<PartInfo>
*** *<Name>engine0_turning</Name>
**** <VisibleInRange>
******** <Parameter>
********** ** <Sim>
************** **<Variable>GENERAL ENG RPM:1</Variable>
************ ****<Units>rpm</Units>
********* ***</Sim>
******** </Parameter>
****** **<MinValue>1</MinValue>
**** </VisibleInRange>
</PartInfo>

The new entry shows up correctly in the Animation Manager in GMAX. The selection of it and the export to generate a new model works OK. The following readout RPM %((A:GENERAL ENG RPM:1,rpm) )%!d! in FSX show a value greater than 16000.
So, I expected to see the disk again rotating and to stop turning as soon as the rpm value goes to zero. Nothing like this. The disk does not moving at all. It just stays static.
As a test I assigned the c_gear code in the animation manager to it and the rotation worked during the animation time for the gear function and stopped afterwards. Tells me, that the gear code works and triggers my disk animation correct.
However, I cannot get the function to work as mentioned above. The disk shall always rotate and shall stop at an rpm value zero.
BTW, I also created a new GUID for the new entry also. Any ideas ? Thanks for any help in advance.

Dietmar
 
The <VisibleInRange> parameter is for hiding/showing a part depending on the control var value. To animate it, you need to write a proper code.
Something like:

Code:
<AnimLength>360</AnimLength>
    <Animation>
      <Parameter>
        <Code>
 	  (A:GENERAL ENG PCT MAX RPM:1, Percent) 36 * dnor					
	</Code>
      </Parameter>
    </Animation>

Tom
 
Ahaaaaah, now I understand the trick. Let me see how it works in my case.
I'll let you know.
Thanks !!

Dietmar
 
Hello taguilo,

this code code works now perfect for me:

Code:
<PartInfo>
    <Name>engine0_turning</Name>
    <AnimLength>100</AnimLength>
    <Visibility>
      <Parameter>
        <Code>
          (A:GENERAL ENG RPM:1,rpm) 1000 &lt;  if{ 1 } els{ 0 }
        </Code>
      </Parameter>
    </Visibility>
    <Animation>
       <Parameter>
            <Code>
            (A:GENERAL ENG RPM:1,rpm) 1000  &gt;
           if{   (A:TURB ENG FUEL FLOW PPH:1,pounds per hour)   (E:ABSOLUTE TIME, second) * 100  %  }
           els{ 0 }
            </Code>
        </Parameter>
      </Animation>
  </PartInfo>

The big advantage for me is, that I can adjust the rotating speed with the
ThrustSpecificFuelConsumption= entry in the aircraft.cfg.

Again, thanks for your help.

Best
Dietmar
 
Dietmar,

I don't know if this matters, but in the Animation section, I see a couple of flaws with spaces. If you have an extra space, it supposedly will cause the line not to work.


<Parameter>
<Code>
(A:GENERAL ENG RPM:1,rpm) 1000 &gt; <--- 2 spaces between
if{ (A:TURB ENG FUEL FLOW PPH:1,pounds per hour) <-- 3 spaces between

These should have one space between them. If the code is working and animating fine, then never mind, but it might help in the future with other codes though.

* EDIT: funny, as I saved this post, it corrected the spacings. In EDIT mode, the spaces are still there. sigh....
 
Bill, this forum software is sometimes funky and inserts blank spaces where none are called for. If you recall, sometimes it will even put a blank space in the middle of a variable name! :eek:
 
Dietmar,
I don't know if this matters, but in the Animation section, I see a couple of flaws with spaces. If you have an extra space, it supposedly will cause the line not to work.

No Bill, extra spaces don't matter at all, they will be discarded by the script parser at runtime.

Tom
 
Thanks all,

so, one thing more I learnd if a code will be inserted. BTW The rotation works great !!

Dietmar
 
Back
Top