Gmax Animation
Tutorial
In this
tutorial you will learn how to animate the fan blades for a locomotive.
The methods used to create the fan animation can be adapted to any
Trainz object.
Note. To complete this tutorial you will need
to have available a model that has already been textured and has an unwrap
UVW modifier applied to it. You can get the demonstration file here.
|
|
1. Sample files
The
following screen shot shows the model I am working with. There are
two items in this model the fan guard and the fan blades.
|

Figure 1 Fan
|
|
2. Dummy objects
The
first item we need to add is a bone or dummy item. To add a dummy
item in Gmax you need to go to the "Create" tab and then to the "Helpers" tab
|

Figure 2 Dummy menu
item
|
| In
this case you will need
to create two dummy items. It is recommended to create the dummies
in the top view. Once you have created the dummy items you will need
to rename them. For animation to work in Trainz the dummies must
begin with b.r. If you do not name them correctly then
Trainz will not recognize them. For
this example I will name them b.r.main and b.r.fans1
3. Dummy
placement
Once
you have renamed the dummies you will then need to move the dummies
to the correct location. The b.r.main should be moved as close as
possible to 0x and 0y. The Z axis I usually keep the dummy about 200mm
or 8" above
0. The location is not that important. The
location of the b.r.fans1 is however critical as it is what controls
the animation. For the fan blades the dummy needs to be at 0,0,0. If
it is not at this location then the fan will appear to oscillate when
the animation is running. 4. Linking
Once the dummies are in location we can then start linking the items together. To link them together first select the link button and then select the item
|

Figure 3 Link tool
|
| To
make it easier to see if a link has been made I usually change the
view setting to "wireframe" which can be done by right clicking on
the text in the top left corner of the workspace. You
need to create the following directory structure which can be shown
by pressing H:
|

Figure 4 Directory
structure
|
You may need to
check the box "Display Subtree" to show the structure.
5. Time
rate Once
you have this directory structure we then need to set up the time
rate for the animation. To do this we need to click on the following
icon located in the bottom right hand corner.
|

Figure 5 Time setup
button
|
Once you have the
window shown in figure 6 open we need to change the Animation start and end
time.
|

Figure 6 Time configuration
menu
|
The
easiest way to do this is to select the "Re-scale Time" button which
will open the following window
|

Figure 7 Re-scale
time window
|
| Where it says frame count,
change the value here to 31 frames. Some people use a different number
here but I find 31 gives a good smooth animation. Once you have changed
the frame count click OK and the animation start time should be the
same at 0 but the end time should now be 30. If the "Track Bar" is
not visible at the bottom of the screen then you will need to turn
it on. To do this go to the "Customize" menu and the "Show
UI" and
select "Show Track Bar" from the menu.
|

Figure 8 Turning
on the Track Bar
|
|
6.
Animation
Now
we are ready to start the actual animation of the fans. Firstly select
the b.r.fans1 dummy. Then select the rotate tool.
|

Figure 9 Rotate
tool

Figure 10 Animation
keys
|
In Gmax you will
then need to select the animate button (See figure 10). Before you
move anything
you need to make sure that everything is in the correct starting location.
|

Figure 11 Keyframe1
|
| This will allow a base
key or zero key to be created as shown in Figure 11 which is the starting
point of the animation. We now need to move the animation to the next
key. Select the bar between the arrow keys as shown in figure 11 and
move it to the right and frame 1 will be selected. Make sure you have
the rotate tool selected as shown in figure 9. Once
you have moved to frame 1 select the text in the z: co-ordinate box
and type in 12 then press enter. If you have every thing linked correctly
and the correct dummy selected then both the dummy and the fan should
have rotated 12º in a counter clockwise direction (looking from the
top) and two new keyframes should have been created one at 0 and
one at 1.
|

Figure 12 Rotate
co-ordinates

Figure 13 Animation
keys
|
|
7. Testing
When
you have created a key for each frame you can test out your animation
by clicking on the "Play Animation" button. If the fan oscillates
then you did not have the dummy located at the center of the fan.
If it
seems to skip or pause then you may have missed a step when setting
keys. Check each key manually and make sure that each frame number
has a rotation value as set out in the table below. If you have missed
a key then you will need to redo any of the keys that are incorrect.
You can also have problems when using Gmax to create the values in
between if you did not specify the correct value for the correct
key then Gmax will calculate the rest of the values incorrectly and
you
will have to start again. |
Degrees |
Frame |
Shortcut |
0 |
0 |
0 |
12 |
1 |
|
24 |
2 |
|
36 |
3 |
|
48 |
4 |
|
60 |
5 |
|
72 |
6 |
|
84 |
7 |
|
96 |
8 |
|
108 |
9 |
|
120 |
10 |
|
132 |
11 |
|
144 |
12 |
|
156 |
13 |
|
168 |
14 |
168 |
180 |
15 |
180 |
-168 |
16 |
|
-156 |
17 |
|
-144 |
18 |
|
-132 |
19 |
|
-120 |
20 |
|
-108 |
21 |
|
-96 |
22 |
|
-84 |
23 |
|
-72 |
24 |
|
-60 |
25 |
|
-48 |
26 |
|
-36 |
27 |
|
-24 |
28 |
|
-12 |
29 |
|
0 |
30 |
0 |
|
|
8.
Exporting
Once
you have the animation complete then we need to export the fan to the
Trainz format. Deselect everything and select "Export" from the file
menu. Type in a name with the .im extension. Then select the "Trainz
format [*.IM,*.KIN,*.PM]" entry from the file type drop box and click "Save".
Then select "Export" again and this time type in a name and use the
.kin extension. When the "Export Animation" dialog box appears click
on the "OK" button.
9. Config entries
Now
that you have exported the file into the Trainz formats you will need
to set up a directory structure and create a config file with the line "animdist
X" for bogeys with the X being the circumference of the wheel in metres.
For scenery, locomotives, interiors and rolling stock the animation
needs to be set up in the config file. Animations can be controlled
with a script or they can be set to auto run.
Was this tutorial helpful? Not enough or
too much detail? Points not explained properly? Suggest any improvements?
Please let me know what you think here.
Download this tutorial here as
a PDF document.
|