How to make a small car for the Game Engine

In this tutorial, we will build a simple small car to be used with the Game Engine (GE) that is included with Blender. We will use and complement the article written by Sandra Gilbert in Issue 8 of the Blender Magazine Low Poly Car And Small Driving Gamelet. We will use this picture, included with the tutorial. Right click on it and save it on your hard disk.

/images/Car.jpg.

Preparing Blender

Start Blender. Next, we need to prepare Blender for the task at hand. We'll need two views when making our car: we will have a Top view by pressing 7 on the numeric keypad on the right of your keyboard. This view will be used to ensure that everything is on one single plane. The next view will be the Front view, or 1 on the numeric keypad, for the drawing of the car shape.

Hover the pointer on the horizontal line between the View and Panels menus.

/images/HoverTheLine.png

The pointer will transform into a vertical twin arrow. Right-click and a menu will appear.

/images/SplitArea.png

Left-click on the Split Area selection and hover the mouse on the 3D window.

/images/SplitAreaTop.png

Figure 1 : Top and Side View in Blender
Enlarge
Figure 1 : Top and Side View in Blender

A new vertical line will appear. While the vertical line is in the 3D view, click the LMB (Left Mouse Button). Now we have two views of the same object. While the pointer is over the left side, press 7 on the Numeric Keypad or Num 7 for the Top View. Go over the right side and press Num 1 for the Front View. This will be our main window; the one in which we will make the shape of the car. Move the pointer over the vertical line separating the two views. We now have a horizontal line with a double arrow. Press your LMB (Left Mouse Button) and while holding the mouse button down, move around and see that you can modify the size of the window. Make the left side about a quarter the size of the main Front View.

Now we will delete the cube. Since we are already in Object Mode, and the cube is selected, indicated by the pink line, we delete the object by pressing the X key, answer Yes to the question OK? Erase selected Object(s). Our workspace is now empty.

Inserting a Background Image

Now we will start our project by inserting an image as a background so we can create a rough sketch. In the Front view, click the View menu at the bottom of the screen, then choose the Background Image... item.

/images/BackgroundImageMenu.png

A small transparent window will appear in the Front view. Click on Use Background Image then Load. A directory will replace the Top view on the left. Select the picture Car.jpg from the location in your hard drive and click the Select Image button.

/images/LoadBackgroundImage.png

We now have the background image showing in the Front View!

/images/BackgroundImageLoaded.png

Making the Wireframe

A few words of advice before we start working on our car.

  1. First, the image that we see in our front view only exists for reference purposes; if you move the view only slightly while pressing the Middle Mouse Button (MMB), the image will disappear! To quickly recover the view, press 1 on the keypad.
  2. Secondly, it is very important that all the lines are on the same plane for later extrusion; always check your work with the top view on your left. If there is a problem, you can go back by deleting the last operation with Ctrl-Z.
  3. Before moving on, now would be the time to name our project. Press Ctrl-W for Ctrl-Write and choose a name. For this first time, it is important that you write the extension .blend to your project, such as Supercar.blend.

The beginning of a car

We begin our car by making a line. In front view, press the Spacebar to see a menu appear. Select Add -> Mesh -> Plane

/images/AddMeshPlane.png

We are now in Edit Mode instead of the Solid Mode. To see the difference, press Tab on the keyboard to switch between the two modes. A selected object in Edit Mode is always pink with the borders, or Vertices, yellow. This is the mode in which we modify and create shapes that will become objects.

/images/EditMode.png

In Object Mode, our selection becomes gray with a pink line: this mode is used to add colors and textures.

/images/ObjectMode.png

Stay in Edit Mode. We will move the square by pressing G. With the mouse, move the square to the lower left corner of the car, just behind the front wheel. We will transform the square so that we have the basic shape of the car.

/images/MoveCube.png

For the next series of manipulations, we will be in Edit Mode. The square that we see is composed of four lines, or Edges and four points, called Vertex (Vertices in plural) in the Blender universe.

Now, press A to de-select All the elements that make up the square.

/images/Deselected.png

We must now select the top edge of our plane. Selection is something that we do all the time in Blender and we have many ways of doing this operation. For now, we will use one of the most common ways of making a selection. Press B, for Border, the cursor will change into a dotted cross-hair that moves with the mouse movement.

/images/BoxSelect.png

From the top left corner, press and hold your LMB (Left Mouse Button), and go to the right and down across the plane to select the top edge.

/images/TopEdgeSelect.png

We have the top edge selected.

/images/TopEdgeSelected.png

We can move and do many transform operations on the selection. We will decrease the size of the square so that it is about the middle of the door. To move a selection, we press the G key, for Go.

/images/MovingWithG.png

We can constrain the movement of our selection to follow a specific axis. Since we want to go to the middle of the door, we press G for Go and then Z, for the Z axis. The axes on the lower left corner of the 3D window will be our guide.

/images/XZAxis.png

So now we have a new shape.

/images/HalfSquare.png

We will move the top edge near the wheel well. We do the same operation but instead of using the Z axis, we will constrain the movement along the X axis. So we press G then X for our axis movement. You will see a white horizontal line: the edge of our shape will move along this line.

/images/XMouvement.png

Place the edge near the wheel.

/images/NewPoint.png

Extrusion

Now comes the tricky part which will require a little patience. We will edit the square by using a few keystrokes to build a rough shape, called a wireframe, of the car. It is NOT important that you respect the shape exactly as later we will use tools to smooth out the angles. If you make mistakes, simply press Ctrl-Z to go back.

Extrusion, E on our keyboard, is a process in which we transform a selection and create a new shape. Extrusion is used fairly often and you will remember the keystrokes in no time.

We have the top edge of our initial square selected. Press E and extrude the surface to the top of the door. Blender will ask if you want to extrude Only Edges or Only Vertices. Choose the default Only Edges.

/images/ExtrudeOnlyEdges.png

We now move the mouse and you will see that a new shape follows the movement of the mouse. Place it near the top of the door. Don't worry too much about the placement as we will make corrections later on.

/images/ExtrudedShape.png

We de-select everything by pressing the A key and select the two edges on the right with Box Select, or B.

/images/RightSelection.png

We extrude our selection, B and place it near the rear wheel well.

/images/RightExtrusion.png

Remember

Changing the shape, one vertex at a time

We have a rectangular shape over the picture of a car but we don't have a car. In the following steps, we will edit the shape to look more like a car.

We de-select everything using A. Move the cursor to the right, near the middle point, and select the vertex by pressing the RMB, the Right Mouse Button.

/images/MiddleRightSelection.png

We will edit the shape and make a rough copy of the car. Press the Z key to toggle the Wireframe mode. This Wireframe mode will transform our shape into a transparent one and will help us place the vertices.

/images/WireframeMode.png

With our selection done in the previous step, press G and move the vertex near the rear wheel well.

/images/MovingAVertex.png

And we move the next vertex.

/images/UpperRightCorner.png

And the next one.

/images/UpperLeftCorner.png

We will expand this shape by selecting the top right edge, extrude it...

/images/RearWheelWell.png

...and place it.

/images/MovedSelection.png

We do the same again: select the edge, extrude it, E, and place it at the end of the rear window.

/images/BottomHalfCompleted.png

We de-select the vertex with A.

The next step is to make the top section of the car. To do so, we select the top vertices with the Box select, B.

/images/TopVertexSideCar.png

We extrude them.

/images/TopSideExtruded.png

And place the vertex along the shape of the car.

/images/MiddleSectionCompleted.png

With the same tools that we used all along, we complete the side of the car.

/images/CompleteSideCar.png

Completing the Wireframe

If you have followed the instructions you should have something that resembles this:

/images/CompletedWireframe.png

If you press the Num 7 key, you should see one line.

/images/WireframeFromTop.png

For the next step, we go from 2D to 3D!

Our car in 3D shape

Now is the time to transform our flat 2D shape into a car. Before we tackle the next series of operations, we do the following:

/images/ReadyToExtrude3D.png

We select the Top View with Num 7

/images/TopViewBeforeExtrusion.png

/images/FirstExtrusion.png

We repeat the operation one more BU.

/images/SecondExtrusion.png

While our front vertices are selected, we will smooth out the car side and give it a shape.

/images/SpecialsSmooth.png

We now have something that resemble half a car seen from the top.

/images/SideSmoothed.png

Mirroring

We will mirror the shape that we have to complete the car.

/images/MirrorYGlobal.png

Our car is now complete.

/images/3DCar.png

Clean up

We must make a last clean up of the vertices. If we go to UV Face Select Mode,

/images/UVFaceSelect.png

one half of our car looks odd: it is inside out.

/images/InsideOut.png

To correct this problem, go back to Edit Mode and do the following:

/images/RemoveDoubles.png

/images/CompleteUVCar.png

Your car is finished. Now would be a good time to save your project.(Ctrl-W)

Wheels

We need wheels for our car. We will create one wheel that will be copied three times.

/images/MPP.png

Go to the Front View, Num 1. Press the Spacebar, Add a Tube of 12 vertices. Move the tube, using G, to the center of the wheel, and with S scale it to the size of the tire in the background image.

/images/TubeInWheelWell.png

Switch to the bottom view Ctrl-Num 7 and move the tube from the middle to the side of the car.

/images/BottomCar.png

We border B select the bottom vertices and Grab them on the Y axis and narrow the tire.

/images/InsideTire.png

De-select all using A. Now we select the front vertices of our tire. Use the B box selection or press the B key twice so that you will have a circular target selection. Once selected, press the RMB to get out of the circular target selection. By using the MMB, you can enlarge or shrink the target area.

Once our selection is done, we make a copy of these vertices Shift-D then Esc without touching the mouse. We will extrude, E, then shrink Alt-S the circle so as to make our tire.

/images/FrontTire.png

We do the same again and shrink the selection to the smallest point possible, this will be our mag wheel.

/images/Magwheel.png

We select the whole wheel ...

/images/MagwheelSelected.png

and remove double vertices. Verify that the faces on the surfaces are normal by going into the UV Face Select mode. If you see the inside out, select the faces, go into Edit Mode and do a Flip Normals to put everything back in order.

Putting wheels to our car

No we'll add the wheels to our car. Select the whole wheel. Go to the bottom view with Ctrl 7 and change the pivot point from Median Point to 3D Cursor.

/images/3Dcursor.png

Locate the cursor in the middle of the car so that we will mirror the wheel front the center of the car. Before we start, you should have something that looks like this:

/images/OneWheelCar.png

Duplicate the wheel using Shift-D, then Esc. Press M for our first mirror operation. Choose Y Global in the Mirror Axis Menu. We now have a two-wheel vehicle.

/images/TwoWheelsCar.png

We repeat these operations to obtain a four wheel car. We have the lower left tire selected. So we duplicate it using Shift-D, Esc, mirror on the X Global axis. For our last one, we do the same: Shift-D, Esc and Y Global

/images/FourWheelCar.png

Congratulations!

You have a complete car plus you learned a lot about Blender.

We paint our car

Now we're going to learn how to paint our car for the game engine. We go to UV Face Select mode and select all the faces of our car using A.

Locate the Texture face panel.

/images/SelectUVFace.png

Click on the white square besides the Set VertCol (Set Vertex Color) button and choose your color. Move the mouse and the color panel will disappear; the color you just chose will fill up the square. Just click on the Set VertCol to apply the color to the entire car. For the first color, we'll choose a bright red but any color will do.

After this first color, we can select individual faces and apply specific color. For example; black for the tires and light grey for the windshield.

Our car should look like this:

/images/Final PaintedCar.png

We won't worry about the edges because the car will be used in real time in the Bullet Game Engine. In the game environment, we don't need too many details because this slows down the render of our game.