3. Simple Construction - A Diesel Loco - Part Six


Version 2.0 - May 2008

Pivot points

To let all the parts of the loco appear at their right places and let them animate correctly, you have to adjust some pivot points first.

Caution!

 The pivot points of the wheelsets and the connecting rod set are on their right places. They must not be moved in any case.

Should one ore more of the wheels' or connecting rods' pivot points been moved to zero accidently, this can be undone by clicking Center to Object.

To give the pivot points their right position, you select the Hierarchy toolbox and activate the button Affect Pivot Only. Select the individual parts with the Select by Name tool.  Then with the Move tool and the Transform Type-In dialog, you move all pivot points to zero (all three coordinates: X, Y and Z), except the pivot points of the wheelsets and the connecting rod. Then you deselect Affect Pivot Only.

The Hierarchy of objects

The MSTS to work properly, must receive the model objects with the correct hierarchy setting and proper part names. On the highest Hierarchy level, the so called root level, only one object (node) named Main is allowed, otherwise MSTS will crash when loading the object. All other objects, which are called nodes in the terms of the MSTS hierarchy, are to be linked to the Main object.

The Hierarchy of your model's objects must be set before adding any animations.

Using the Select Tool select the Connecting Rod.  Activate the Select and Link Tool and press the H key. The Select Parent dialog opens. You select the Wheels2 and click the Link button. 

Use the Select Tool and press the H key.  Select all other objects, except Main and the Connecting Rods.
 
Activate the Select and Link Tool and press the H key. The Select Parent dialog opens.   You should only have one choice, Main.  Select Main and Link all the selected objects to it.  The Connecting Rods do not show here because they are already linked to Wheels2.
 

Deactivate the Select and Link Tool. Activate the Select Tool.  Either press the H Key or click the Select by Name Tool.   With  the Display Subtree checkbox checked, the Hierarchy should be shown like this:


Now you add some movement

After closing the Select window, you have to do the animation settings. You open the Time Configuration dialog.

 

 In the Animation section, you type in the following values:

  • Start Time: 0
  • End Time: 8
  • Length: 8
  • Frame Count: 9

The wheels animation is done in steps called Frames. The animation must be done with nine frames of 45 degrees rotation each. The first and the last position of the wheels are identical. The in-between positions are calculated by MSTS itself.

Caution!

It is possible to animate the wheels with any other number of frame count and other degrees of rotation.

I would like to discourage anyone from doing that!

With the proper frame count and 45 degree rotations, MSTS needs the wheel radius set in the .eng-file. With another frame count, this value would have to be changed. This is possible but could seriously affect the behavior of the loco.


Wheels first...

In the Left viewport, you select the Animation button. The viewports frame turns red. The first animation step (frame 0) is unaltered. You pull the slider on the bottom of the viewport from the position 0/8 to the position 1/8, which means step 1 of 8 (Remember that this is the second frame as you are counting from zero to 8).

You select all three wheelsets with CTRL click.

After activating the Angle snap toggle and the Rotate symbol, you slowly draw the mouse downwards from the center of the wheelset wheels2. All three wheelsets should rotate now. You draw until the Z value reads 45 degrees.  Use the box and grid lines as a guide.

The coupling rod is linked to the center wheel only, and therefore it will follow the rotation.

Now select the Connecting Rod.

Rotate the Connecting Rod 45 degrees to the horizontal  plane.

 

Then, you draw the animation slider to the 2/8 position and rotate the wheels and Connecting Rod another 45 degrees.

You repeat these steps for all the slider positions... 


...until you reach to the starting position again.


When finished, you deactivate the animation button. With the animation slider, you can watch the whole animation.  You can also use the Play Button to the right of the Animation Button to watch the animation in a loop.

Move your slider back to Frame 0 when you are done. 


Preparing the export to MSTS

For our loco, you use the files of MSTS' GP38 diesel loco. To do this, you create a new folder named gmax01 in the C:\Program files\Microsoft Games\ Train Simulator\TRAINS\TRAINSET folder.  From the TRAINSET\GP38 folder you copy the SOUND and CABVIEW folder and the files gp38.eng and gp38.sd to our new gtd1 folder. Make sure not to move the files accidentally.


Now, you rename the file gp38.eng into gmax01.eng and the file gp38.sd into gmax01.sd. With a Unicode editor (Notepad in W2k or otherwise WordPad) you open the file gmax01.sd and change the entries in the third and seventh row as follows:

  • shape ( gmax01.s
  • ESD_Bounding_Box ( -1.5 0.055 -5.35 1.5 4.885 5.35 )

The shape entry gives the name of the shape file. This is the file containing the 3D-data. You know this file by its .s extension. The ESD_Bounding_Box entry describes a square around the loco with contains among others the collision detection data. The values from left to right are:

  • -1.5     One half the width of the bounding box to the left of center 
  • 0.055  The lowest vertex position. (a wheel for loco or rolling stock.  This value has to be above the rail level.
  • -5.5      One half the length of the bounding box to the rear of center
  • 1.5       One half the width of the bounding box to the right of center
  • 4.8         The total height of the bounding box
  • 5.5        One half the length of the bounding box to the front of center

Then you save the file.

Where do these numbers come from?  Many you can determine by the dimensions of the larger parts in the model, but others are not so obvious.   If you create a model of your own design, you may have many parts and keeping track of which ones are longest or widest can be difficult and confusing.  The best method of getting the correct numbers is to first export the shape into MSTS and view it using Shape Viewer.  In the View menu of Shape Viewer, towards the bottom is an option for bounding box info.  All of this data is there and it would be best to edit or create your SD file from that data after exporting your model.

In the physics file gmax01.eng, you change the following entries as shown:

  • Wagon ( gmax01
  • WagonShape ( gmax01.s )
  • Engine ( gmax01
  • Wagon ( gmax01 )
  • Name ("gmax01")
  • Description (
    "gmax01 - Tutorial Loco from GmaxTutorial"
    )

These lines are spread all over the file. You will have to search for each and change accordingly

Caution!

The brackets have to be set as shown above.

Then you save the file and copy the gtd1.ace file into the C:\Program files\Microsoft Games\ Train Simulator\TRAINS\TRAINSET\gmax01 folder


Making the loco visible.

To make the loco visible, MSTS has to know which polygons are to be loaded into the graphics memory. At greater distances, not all polygons of a loco can be seen at all. Therefore it is not necessary to load and calculate them. That would lead to the MSTS' HD loading hang-up for a few seconds in the worst case. You load big parts in the distance of 1000 meter and the other parts step by step when the loco gets nearer:

  • The Chassis disappears at 1000m or greater
  • Wheels disappear at 500m or greater
  • Connecting Rods and Bumpers disappear at 200m or greater
  • Everything is visible at 50m

This is done with the Level of Distance manager Trainsim 1 LOD Tool which can be found in the Train-Simulator menu:


First, you select the loco in one of the Viewports and click the Plus sign in the LOD tool. In the LOD-Distance field, you type the value 50 and hit Enter.

NOTE:  The picture shows the Modify command has been selected.  This is not used with this first LOD level, but will be required for the next 3.  It also advised to hit the Enter key on the keyboard after entering the LOD Distance value.  Failing to do so can result in the value being reset to 0 and you will have an incorrect LOD parameter in your final shape file.


Add the next LOD level.  Click the + and enter a value of 200 in the LOD Distance box and hit Enter.

At 200m, you want to hide the Connection Rods and Bumpers.  Clicking on the + next to Main in the Hierarchy section of the LOD Tool will expand the Hierarchy tree.  Select the first component that you want to make invisible at this distance, in this case, the Connecting Rods.

You will see the Modify screen now shows rod01 selected.  In the Modify screen, click on Polygon select (DO NOT CLOSE THE LOD TOOL).  

In the Left Side Viewport draw a box around the Connecting Rod to select all of the polygons.  You should see 184 faces selected. 

In the Modify screen, click on Delete.  A message will pop up asking if you want to Delete Isolated Vertices.  Answer Yes.  You will see the Connecting Rods disappear.  You have not permanently deleted anything from your model, you have only deleted these polygons for this LOD Distance.

Repeat this sequence for the 2 Bumpers (Cylinder01 and 02).

You should end up with this for an LOD Distance of 200m:  No Bumpers, no Connecting Rods.
 
LOD Distance 200 is done.
You repeat the same steps to create the LOD Distance levels for 500 and 1000.  Add a new LOD Level for 500 and hide the Wheels. 
LOD Distance 500 
 
LOD Distance 1000 
 

Putting together all non animated objects.

To increase the frame rate of MSTS, you can put together all non animated objects. They are still independent objects but they build a matrix in the shape file which can be loaded and animated more quickly by MSTS.

To do this, you select in any LOD-level the objects Chassis, Body Roof and the bumper Cylinders one by one and check the Collapse Node checkbox in the Selected Node field for each.


With File - Export to .S you export the model into our C:\Program files\Microsoft Games\Train Simulator\TRAINS\TRAINSET\gmax01 folder and name it gmax01.s

Close the LOD Tool. 

Don't forget to save the work.

 

WARNING !!!  Close GMAX before starting MSTS.. 
You can test your loco with Conbuilder to see if you have made any errors editing the .eng file.  You can also view it in Shape Viewer to see not only the loco, but test the animation. 

The maiden voyage

To have a ride on our newly built loco, you must create a consist.   Here is a consist ready for you

In MSTS, you select the gmax1 loco and have a ride.


Congratulation!

Our first loco is running!

A Simple Diesel Loco is finished.

Questions concerning this tutorial or MSTS object or loco building can be posted to the Elvas Tower forums.

Have fun

You now have some knowledge of GMAX and should be able to start making some simple objects on your own.  I know that this has not presented every tool that you would need to make many of the items you would like to.

Start with making some simple items and try different things.  Almost any experienced 3D modeler will tell you that they learned by doing and experimenting.  Don't set you first project as a Y6b Mallet or an 0-4-0 yard hog.  Think simple to start with and as your knowledge increases, try more complex projects.  It can take months and even years before you are ready to tackle anything complex.  If you do start a complex project and get stuck, put it aside and make something else.  Go back to your stalled project every once in a while and you may find that you now understand what you did not before.

Have fun and I hope you see your work available for all to enjoy.

back to table of content