HOWTO Animate Objects Using animatedObjects.xml - PMC Farming Simulator 19

HOWTO Animate Objects FS19

2022-02-02T06:14:00Z Updated.

When you edit terrains and use Giants Editor (GE) to import building models which have animated doors, you need to take extra steps to animate the doors, if you use building placeable through defaultItems.xml it will be automatically animated.

We use CBJ Midwest Buildings Pack as an example. If you want to follow this tutorial step by step then download that mod.

In short: GE import CBJ vehicle shed, make sure onCreate is AnimatedMapObject.onCreate, open that sheds placeable XML, copy all the <animatedObject> (note object singular not objectS plural) properties to maps/animatedObjects.xml and done.

GE file -> import, then browse to FS19_PlaceableCBJbuildings directory and choose 40x60shedRed.i3d filename.

This specific model comes with two "light" entities, you can remove those.

FS19 Terrain Tutorial: HOWTO Animate Doors

Now place the building where you like it to be. Then open this buildings transformgroup "40x60MachineShed" and select transformgroup "shopdoor4".

FS19 Terrain Tutorial: HOWTO Animate Doors

Now use windows explorer to browse into your terrain directory of "maps/", create new file here called animatedObjects.xml

FS19 Terrain Tutorial: HOWTO Animate Doors

Open animatedObjects.xml with proper text editor, then copy this following text in there:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<animatedObjects>
    <annotation>Copyright (C) GIANTS Software GmbH, All Rights Reserved.</annotation>

</animatedObjects>

Next browse to FS19_PlaceableCBJbuildings directory and open 40x60shedRed.xml in text editor. Browse down in the XML until you find <animatedObjects> property, now select and copy (CTRL-C) everything in animatedObjects, then paste (CTRL-V) into your animatedObjects.xml file, where the empty line is.

Difficult to explain so here is screenshot of text heh, this is just an non-working example do not use it as is:

FS19 Terrain Tutorial: HOWTO Animate Doors

You can now close 40x60shedRed.xml file.

We need to change few things here to make it work better. First find the line:

<animatedObject saveId="shopdoor4" >

And change saveId to index, like this:

<animatedObject index="shopdoor4">

Now jump back to GE and check user attributes, currently it looks like this, its wrong and not working this is just an example how you might find wrong values there:

FS19 Terrain Tutorial: HOWTO Animate Doors

You need to change index to "shopdoor4". Then onCreate is now saying wrongly "AnimatedObject.onCreate" which is FS17 era naming, you need to change it to "AnimatedMapObject.onCreate" instead. Also while at it, make sure xmlFilename is saying "maps/animatedObjects.xml", sometimes it can be wrong as well.

Next we go over the two other doors found in this model, "garagedoor5" and "garagedoor6". Change both just like you did above, "garagedoor5" index to "garagedoor5" etc.

Now you can save GE terrain project.

Back in animatedObjects.xml we do few more edits. Find "shopdoor4" and its "controls triggerNode" which now says "1|8|0", this needs to be changed to simply "0". Do the same for two other doors controls triggerNode's.

Next still in "shopdoor4" find "part node" which now says "1|8|1", here we do exactly the same thing, remove the node numbers and only leave last which is "1". Again do the same for the two other doors, just leave the last number.

When all that is done your building should have working doors in-game :)

Below is animatedObjects.xml working example for 40x60MachineShed building with our GE model edits:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<animatedObjects>
    <annotation>Copyright (C) GIANTS Software GmbH, All Rights Reserved.</annotation>

        <animatedObject index="shopdoor4">
            <animation duration="1">
                <part node="1">
                    <keyFrame time="0.0" rotation="0 0 0"/>
                    <keyFrame time="1.0" rotation="0 120 0"/>
                </part>
            </animation>
            <controls triggerNode="0" posAction="ACTIVATE_HANDTOOL" posText="action_openGate" negText="action_closeGate"/>
        </animatedObject>
        <animatedObject index="garagedoor6">
            <animation duration="7.5">
		<part node="1">
                    <Keyframe time="0.00" translation="0 0 1.58" />
                    <Keyframe time="1.00" translation="0 0 4.63" />
                </part>
		    <part node="2">
                     <Keyframe time="0.53" translation="0 0 -1.58" />
                     <Keyframe time="1.00" translation="0 0 -4.63" />
                </part>
            </animation>
            <controls triggerNode="0" posAction="ACTIVATE_HANDTOOL" posText="action_openGate" negText="action_closeGate"/>
        </animatedObject>
        <animatedObject index="garagedoor5">
            <animation duration="7.5">
                <part node="1">
                    <Keyframe time="0.00" translation="0 0 1.58" />
                    <Keyframe time="1.00" translation="0 0 4.63" />
                </part>
		<part node="2">
                     <Keyframe time="0.53" translation="0 0 -1.58" />
                     <Keyframe time="1.00" translation="0 0 -4.63" />
                </part>
            </animation>
            <controls triggerNode="0" posAction="ACTIVATE_HANDTOOL" posText="action_openGate" negText="action_closeGate"/>
        </animatedObject>

</animatedObjects>