main-trainui

How the TrainUI works for the framework code and example solution

October, 2008 - By Mike Gleicher
Updated October, 2009 by Mike Gleicher for the 2009 version of class (with visual studio 2008).
Updated October 2010

See also: The discussion of the framework code at TrainFramework

The source code for the framework is available inpub:train/TrainProject2010_Oct07.zip. Note that the version date is in the file name. If newer versions are released they will be announced.

The executable for the framework is Train.exe. This is what you should get if you build the code.The example solution is available as TrainExample2010.

Camera Controls

  • Right Mouse = ArcBall (rotates world)
  • ALT-RightMouse = Pan (translate view)
  • double click Right Mouse = reset view
  • Mousewheel = Zoom In / Zoom Out

Moving Points

The program provides a “Mouse Pole” user interface.

Use the Left Mouse to select and move (with dragging).

When dragging, things move parallel to the ground plane. Unless theCTRL key is held down, in which case things move perpindicular to theground plane.

Some Features of the Sample Solution

The sample solution was written for simplicity, not forefficiency. This might be a problem for you if you don’t have a goodcomputer with a decent graphics card, it might not run fast enough.

Some silly things you might notice:

  • The parallel rails are flat ribbons. And they Z-Fight with the topsof the rail ties. I was going to make them thicker ribbons, but Ididn’t get to it.
  • The wheels on the cars are “trucked” (they swivel to stay on thetrack), but the center of the car is also locked onto the track andthe car rotates around that point. You won’t notice this unless thecurve is really sharp.
  • The wheels on the engine are fixed, so they go off the track in asharp turn.
  • Physics conserves energy - and that’s it. The amount of energy inthe system is set to be sufficient that the train doesn’t stop atthe highest point, so a tall track will have the train going reallyfast at the bottom. There is no friction or anything like that, justpotential energy and kinetic energy transfering back and forth likein a pendulum.
  • Save and Load is relative to where the executable is run from (so ifyou run in visual studio, its relative to the project/solutionfile).
  • The interface for rotating the control points is terrible. But itlet me make some tracks. I actually made the more complicated onesin excel.
  • The “NoAL” buttons let you see what happens if you implement fancytracks or multiple cars without arc length. Its helpful for why understanding arc-length is useful.
Page last modified on October 07, 2010, at 05:15 PM