Gmax
Steam Animation Tutorial
In this tutorial you will learn how to animate steam related mechanism
for a locomotive.
|
| 1.
Add and resize shapes
You need to create three
cylinders and two boxes and resize them as follows
| Parameter |
Cylinder1(Wheel01)
|
Cylinder2
(Wheel02)
|
Cylinder3(Piston01)
|
Radius
|
0.5
|
0.5
|
0.15
|
Height
|
0.1
|
0.1
|
0.5
|
Height Segments
|
1
|
1
|
1
|
Cap Segments
|
1
|
1
|
1
|
Sides
|
18
|
18
|
18
|
Parameter |
Box1 (ConnectingRod) |
Box2 (CouplingRod) |
Length |
1.2 |
1.2 |
Width |
0.02 |
0.02 |
Height |
0.1 |
0.1 |
Length Segs |
1 |
1 |
Width Segs |
1 |
1 |
Height Segs |
1 |
1 |
|
Now that you have created and resized the objects I recommend that
you rename them to the name shown in the brackets above. HINT. I always
rename any object I create as this makes it much easier to find in the
various lists of objects.
|
2.
Rotating and resetting xform
Select
Wheel01 and then select
the rotate tool from the main tool button menu and type 90 into
the Y
co-ordinate. Do the same for Wheel02. For the Piston01 you will need
to enter 90 into the X co-ordinate. Once you have done this use the "Reset
X-Form" on all the cylinders.
|
3. Relocating
Now
we can position the cylinders and boxes. Select the move tool from the
main tool button menu. Type in the following co-ordinates for each object:
| Co-ordinates |
Wheel01
|
Wheel02
|
Piston01
|
ConnectingRod
|
CouplingRod
|
| X |
0
|
0
|
0
|
-0.03
|
-0.01
|
| Y |
0.6
|
-0.6
|
2.6
|
1.5
|
0.4
|
| Z |
0
|
0
|
0
|
-0.05
|
-0.05
|
Now that we have everything in location we should have a result similar
to figure 1
|

Figure 1 Results
after resizing, rotating and moving
|
| 4.
Dummy objects
The
next item we need to add is a bone or dummy item. To add a dummy item
in 3ds 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 six 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 as follows.
| b.r.main |
| b.r.wheel01 |
| b.r.wheel02 |
| b.r.connecting_rod |
| b.r.coupling_rod |
| b.r.piston01 |
5.
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 and in this case I have moved the
dummy 500mm above 0.
The
location of the other bones is however critical as it is what controls
the animation.
Item |
X |
Y |
Z |
| b.r.main |
0.0 |
0.0 |
0.5 |
| b.r.wheel01 |
0.0 |
0.6 |
0.0 |
| b.r.wheel02 |
0.0 |
-0.6 |
0.0 |
| b.r.connecting_rod |
0.0 |
2.1 |
0.0 |
| b.r.coupling_rod |
0.0 |
0.95 |
0.0 |
| b.r.piston01 |
0.0 |
2.6 |
0.0 |
|
6. 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. At this stage we don't want to link the Piston01, ConnectingRod and
b.r.piston01 objects to anything
Link b.r.wheel01 and
b.r.wheel02 to b.r.main
Link b.r.coupling_rod and Wheel01
to b.r.wheel01
Link Wheel02 to b.r.wheel02
Link b.r.connecting_rod and
CouplingRod to b.r.coupling_rod
|

Figure
4 Directory structure
|
You may need to check
the box "Display Subtree" to show the structure. If you do not copy the
above directory structure exactly then the animation will not work properly.
|
7.
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
|
|
8. Animation
Now
we are ready to start the actual animation of the wheels. Firstly
select the b.r.wheel01 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
set a base key or zero key as shown in figure 11 which is the starting
point of the animation. We now need to move the animation to the key 14.
Select the arrow key pointing to the right as shown in figure 11 and the
bar will move and frame 1 will be selected. Continue moving until you
reach key 14.You can also drag the slider to key 14. Make sure you have
the rotate tool selected as shown in figure 9.
Once you have moved
to frame 14 select the text in the X: co-ordinate box and type in 168
then press enter. If you have every thing linked
correctly
and the correct dummy selected then both the dummy and the wheel01 should
have rotated 168º in a clockwise direction (looking from
the left).
|

Figure
12 Rotate co-ordinates
|
Now
you need to press the "Key" button again then index to the frame 15, rotate
the dummy to 180 degrees and press the "Key" button. You will need to
do this for each of the frames listed in the following table.
Degrees |
Frame
|
0 |
0 |
168 |
14 |
180 |
15 |
0 |
30 |
|
|
Figure
13 Animation keys
|
| Now repeat
the above procedure for the second wheel.
9.
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 wheel oscillates then
you did not have the dummy located at the center of the wheel. 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 above. 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. |
|
10. Changing link types
When you
tested the animation and if you had everything correctly linked then
you
will notice that the wheel connecting rod (CouplingRod) moved with the first
wheel but rotated as well. To fix this we need to change the link
type.
Select the b.r.coupling_rod dummy and then select the "Hierarchy" tab
and then select the "Link Info" sub tab. Under the "Inherit"
section ensure that the "Rotate" X,Y,Z check boxes are unchecked
but make sure you don't change the "Move" check boxes. This
will allow the bone to move with the wheel but it will not be rotated.
|
|
Figure
14 Hierarchy icon

Figure
15 Link settings for b.r.coupling_rod
|
11. Adding a constraint
Now that
we have solved the wheel connecting rod problem we need to setup the
other connecting rod. To do this we need to add a controller called a "LookAt
Constraint". Firstly select the b.r.connecting_rod and then go to the "Motion"
tab. Expand the section called "Assign Controller". In the
window select the entry called "Rotation : TCB Rotate. Then click
on the
"Assign Controller" which is the box with a green shape and
an arrow on it. Then in the menu that appears select the "LookAt
Constraint" and click on "OK"
|

Figure 16 Motion
tab

Figure 17 Link
settings for b.r.connecting_rod

Figure 18 Assign
controller button

Figure 19 LookAt
Constraint
|
Now that the constraint has been added we then need to add a target.
Select the "Add LookAt Target" and then click on the b.r.coupling_rod.
Also make sure the "Keep Initial Offset" checkbox is selected.
|

Figure
20 LookAt Target correctly selected
|
Now we
need to change the "Link Info" for the b.r.connecting_rod. Select
the link and then go to the "Hierarchy" - "Link Info"
sub tab and uncheck the "Move" X and Y checkboxes.
|

Figure
21 Link settings for b.r.connecting_rod
|
NOTE1 When adding LookAt Constraints always add them to
dummies only and always use a dummy as the lookat target. Failure
to do so will cause the animation to work incorrectly within Trainz.
When creating animation's think along the lines of "The Dummies
do the actual work and the linked objects are only along for the
ride".
NOTE2 When changing link properties always use the dummies
link properties. Failure to do so will cause the animation
to work incorrectly within Trainz.
12. Adding final links
Now that
we have all the dummies moving and rotating in the correct manner we
can now link the last of the objects together. Select the link tool and
click
on the Piston01 and link it to the b.r.piston01 do the same for ConnectingRod
except link it to the b.r.connecting_rod. Now link the b.r.piston01 to the b.r.coupling_rod.
Press play again and now the rod should follow the controller but the
piston also follows it. Once again we need to change the link type. Select
the b.r.piston01 and then go to the "Hierarchy" - "Link
Info" tab and uncheck the "Move" X and Z and the "Rotate" check
boxes. Test the animation again and if all is correct then we should
have a working steam animation.
|

Figure 22 Final
linked Subtree

Figure 23 Link
settings for b.r.piston01

Figure 24 Finished
product showing the LookAt Constraint
|
| 13.
Exporting
Once
you have the animation complete then we need to export the drive setup
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.
14. 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.
|