Building a simple wheeled vehicle

This tutorial is to assist developers in creating a simple wheeled vehicle, with collision information for use in the Torque Game Engine.

Getting Started

Ok, let's begin by building a simple wheeled vehicle.

Our goals for this tutorial are to:

Required objects

Care must be taken to model your shapes according to the guidelines detailed in the MAX2DTSExporter Documentation to ensure the exporter recognizes the various components and knows how to export them.

For the model the naming and hierarchical linkage we need to use is as follows;
  • "bounds" a mesh object at the ROOT of the scene, encompasses the complete model and any animations performed by the model.
  • "shape" a dummy object at the ROOT used by the exporter to identify the model, and it various levels of detail (LOD).
    • "collision-1" a dummy object, markers for collisions. Collision-1 thru Collision-9
    • "detail#" a dummy object, at least one must exist, however typically several exist to represent different LOD to be applied against a shape.
    • "LOS-#" a dummy object, markers for "Line Of Sight" collision ("bullet collision") LOS-9 thru LOS-15
    • "start" a dummy object, which identified the start of our model. Any name can be used.
      • "vehiclemesh#" a mesh object, used to make up the model. As many mesh object can be used as long a LOD number is appended to their name.
      • "col-1" a mesh object, this is the actual collision geometry for the vehicle itself. It should be as absolutely LOW POLY as possible. Every polygon counts and will slow the whole game down if you have too many. Also, pay special attention to the way it is shaped to minimize collision with small bumps/hills/slopes etc. Changing this shape will dramatically effect whether or not the vehicle is prone to getting stuck while driving over bumps
      • "LOScol-#" a mesh object, Geometry for line of sight collisions .
      • "eye" a dummy object, this is where the camera will be when piloting a vehicle in 1st-person mode.
      • "cam" a dummy object, this is where the camera will be when piloting a vehicle in 3rd-person mode.
      • "mount#" a dummy object, these are where the players\weapons mount.
        • mount0 -- driver
        • mount1 -- navigator\gunner
        • mount2-8 -- passenger's
        • mount9 -- bomb mount point on the bomber vehicle
        • mount10 -- gun
      • "mass" a dummy object, this is used in the driving\flying dynamics. This should be positioned at the center of mass for the whole shape.
      • "hub#" a dummy object, center point for wheels. Position these where you want the center of your wheel to be in its top most position.
Hierachy
NB: The names given to the objects in 3DS Max are not case sensitive to "MAX2DTSExporter".

Step-by-Step building the Vehicle

In 3DS MAX start a new scene. Follow each of the following steps to create a simple wheeled vehicle.

A few side notes before we begin.

Crate

Crate

Crate

Crate

6 Steps to build the shape
1. Create dummy helper object and name it "shape".
2. Create another dummy helper object and name it "detail110", make it's parent the "shape" object. If you need help linking objects, refer to 3DS Max Online reference for help on the "Select and link" button or linking via the "Schematic View" option.
3.

Create your vehicle mesh(s)

  • Name it "vehiclemesh110". In my example I'm going to use a very simple box. (L=6, W=4, H=1.5) make the mesh(s) parent the "start" object. **NOTE: Make sure your grid is at 1**
  • You can use more then one mesh for your vehicle but make sure they are all appended with 110 (Whichever LOD Detail level you use).
  • After its created move it to 0,0,0. Do this by selecting it with the move tool and right clicking on the move button at the top.
4. Create collision information
  • Create a mesh object whose name is "col-1", position so it surround the entire vehicle area you want to have a collision. Make it's parent the "start" object.
  • Create a dummy helper object and name it "collision-1", make it's parent the "shape" object.
5. Create Line Of Sight (LOS) collision information
  • Create a mesh object whose name is "LOScol-9", position so it surround the entire vehicle area. You could simply "clone" the col-1 and name it "LOScol-9" to create a collision bounding box of same size, and location.
  • Create a dummy helper object and name it "LOS-9", make it's parent the "shape" object.
6.

Create cameras

  • Create a dummy helper object whose name is "eye", position it where you want your camera to be in 1st person
  • Create a dummy helper object whose name is "cam", position it where you want your camera to be in 3rd person
7.

Create mount points (I plan to research this more and have more tutorials on weapons)

  • Create a dummy helper object whose name is "mount0", position this where you want the driver to mount.
8.

Create wheel hubs

  • Create four dummy helper object's and name them "hub0-3" (you can have as many wheels as you want) make their parent the "start" object.
  • Position these where you want the center of your wheel to be in its top most position.
9.

Create the center of mass

  • Create a dummy helper object whose name is "mass", position it at the very center of your vehicle.
  • Generally the best spot is right above the hubs. you will have to play with this to get it to feel right. I plan to research this more and figure out how to use it correctly. so check back!
10. Create the Bounding box
  • Create a mesh object whose name is "bounds", position so it surround the entire shape. The box must encompasses fully the model you have created otherwise you may get any error when exporting.
  • Set the pivot point of the bounding box (Command Panels -> Hierarchy -> Pivot -> Affect Pivot Point) - blue axis points towards the top of the shape, the green axis towards the front of the shape, and the red axis towards the right of the shape.

Exporting the Vehicle

Once your happy with the vehicle, It's time to export it and see how it looks in the Torque Game Engine.

  • Before you start, grab this file (comes in example1.zip), rename it to dtsScene.cfg and put it in the same directory as your max file. (Need explanation of what this is and its settings)
  • From the "Command Panels -> Utilities" select the "DTS Exporter Utility -> Utilities".
  • YOU MUST Uncheck Collapse Transforms under parameters for the DTS Exporter.
  • When your ready click "Whole Shape".
  • When prompted for a filename to export the .DTS shape to, enter one that represents the shape. ie EXAMLPE1.dts
  • The exporter does not currently provide any "status" on the progress of the export, so you may think your computer has frozen, this is normal. If an error occurs it will be reported on screen via a message box (Basically: Be patient!).

Once the export has completed, try out your new model using the Torque Game Engine model viewer as described earlier in this guide.

Exporter

Final comments

Thats pretty much all there is to it. I plan to add examples of doing animations like springs, breaks, and steering wheels.




Copyright 2002 TGEV. All rights reserved.
Please notify me if you plan to redistribute this article