The famous Thompson submachine gun is a somewhat obsolete weapon that most people are familiar with visually, even if they don't know what it's called.
The technique we will use is the Extrusion method. When it comes to modeling weapons,
For our Tommy gun, I'll work from a sketch I made, shown in Figure 16.21.
Figure 16.21: Tommy gun sketch.
To create your weapons, you can use a photograph or detailed diagram of your own if you like, however, you are
The sketch is rough and not very detailed, but it will do just fine for our purposes. This model will have as few polygons in it as I think we can get away with. I've made two versions of it for you to use: one for the skin and one to act as the extrusion reference image.
Get MilkShape running and warming up in the
Select the Vertex tool, making sure that the Auto Tool check box is cleared.
In the Side view, start placing vertices at all the major corners and points around the
Figure 16.22: Tommy gun vertices.
Start making faces. No! I
Be careful as you move along, making sure you get all the faces. For tips and other information on faces, check back to Chapter 15. Figure 16.23 shows the finished polygon faces around the muzzle, which can be a bit fiddly. Notice how far I zoomed in.
Figure 16.23: Tommy gun muzzle faces.
Figure 16.24 shows the barrel and forestock faces. A warning about the barrel is in order here, I think. In this model we will stick with a straight extrusion exercise—but I highly recommend that after you complete this section you
Figure 16.24: Tommy gun barrel and forestock faces.
Figure 16.25 shows the faces completed for the grip, the receiver, the magazine, and other metal
Figure 16.25: Tommy gun metal body faces.
Figure 16.26 shows the faces of the wooden shoulder stock.
Figure 16.26: Tommy gun shoulder stock faces.
Now take a look at Figure 16.27. Notice the missing polygon down there in the 3D view? It's not evident by looking at the wire-frame view that the polygon was missed, but its absence really shows in the 3D view. Don't let this happen to you! Heh.
Figure 16.27: Tommy gun loses face—film at 11.
If it does happen to you, fix up the wayward faces and we'll move on to the extrusion.
Select all the faces.
Use an X value of 2.0 and then click the Extrude button. Do not deselect the highlighted faces after this operation. You should get something that looks like Figure 16.28.
Figure 16.28: Extruded Tommy gun.
Next, we will have to cap off one end of the extrusion, like we did with the car model. It's a simple operation but sometimes a bit touchy.
Choose Edit, Duplicate Selection.
Use the Move tool to drag the copy of the faces back over to the side of the model, using the Front view window to monitor the activity.
Zoom in on a few of the vertices in the Front view and make sure that the copy of the faces perfectly aligns with the edge vertices on this side of the model.
Select all vertices in the model and then choose Vertex, Snap To Grid. One or two of the vertices might snap to an
Choose Vertex, Weld Together.
The model as built so far is fine, except that it was created at a scale four times larger than we want for use in game. This was
Select all parts of the model.
Use the Scale tool to set the scale to 0.25 in all three axes.
Click the Scale button to the right of the axis boxes. The gun will shrink and should appear
Figure 16.29: Shrunken gun.
Next, we have three nodes to add—one to indicate where the gun is held, one to indicate where the muzzle is, and one to
Create three unconnected joints, positioned and named as shown in Figure 16.30. The three node
Figure 16.30: The Tommy gun nodes.
We have one more thing to do. We need the gun to have the correct
In the Top view, select all faces.
Rotate the gun about 8 degrees to the left, as shown in Figure 16.31.
Figure 16.31: The
Move the nodes to align them with the gun, using Figure 16.31 as a guide.
Voil! Insta-gun. Save your work.
Way back in Chapter 13 you learned how to use UVMapper and Paint Shop Pro to create a skin for objects. In this chapter we'll look at using the built-in Texture Coordinate Editor in MilkShape to accomplish the same thing. It can be awkward to use but is suitable for our purpose here because we will already have a texture to use for the skin—in this case we will use a version of my original sketch.
Create a new material, using the file tommygun.bmp as the bitmap for the texture.
Assign the new material to the Tommy gun object.
If you have more than one object, select all of the faces in all of the objects, then regroup them. After that, you can assign the new material to the single object.
Use the Groups tab, and select the Tommy gun object.
Choose Window, Texture Coordinate Editor. You will get the Texture Coordinate Editor dialog box, as shown in Figure 16.32.
Figure 16.32: Texture Coordinate Editor dialog box.
When the Texture Coordinate Editor first opens, you often see just some confusing white lines over the top of the texture assigned to the object you are skinning. Not to worry.
Select the appropriate view from the view selection combo box at the right side of the dialog box. In the case of the Tommy gun, this is the Left view.
Click the Remap button. You should get something like that shown in Figure 16.33. The shape of the Tommy gun may not line up with the texture, so go ahead and use the Select and Move
Figure 16.33: Remapped view.
Close the Texture Coordinate Editor dialog box and take a look in your 3D view (make sure that it is set to texture mode). There it is—your Tommy gun! Compare your work with Figure 16.34. As you examine it closely, you will see why it might be a good idea to redo the barrel as a cylinder.
Figure 16.34: Finished Tommy gun.
In order to test the Tommy gun, we first need to export it from MilkShape.
After saving your work, choose File, Export, Torque Game Engine DTS. You will see the Torque Game Engine (DTS) Exporter appear.
Use the defaults, but make sure they are correct.
You want to have Export Animation and Export Material Information enabled, and the Collision Mesh set to None (this is automatic if the exporter finds that there is not a mesh whose
Export your Tommy gun to DTS format as C:\3DGPAi1\fps\data\
Next, you need to edit the script that controls the weapon so that it will look for your model, and not the default one. We'll use the simple futuristic
Locate the file C:\3DGPAi1\fps\server\scripts\rifle.cs and
Find the line that says this:
shapeFile = "~/data/shapes/buggy/
and replace it with this line:
shapeFile = "~/data/shapes/car/car.dts";
Then find the line that says this:
pickUpName = "a rifle";
And replace it with this line:
pickUpName = "a tommygun";
Save the file.
Okay, now it's time to run the fps demo.
Browse to C:\3DGPAi1 and click on the Run fps Demo shortcut.
Click Start Mission.
In the Launch dialog box, make sure that the Multiplayer Mission box is cleared.
Select Water World from the mission list.
After the game loads, look around for a big gray block jutting out from the side of a hill into the water. Figure 16.4 in the earlier section about the Health Kit shows what the block (
Run over to the block. On top of it you will find the Tommy gun.
Run over the gun to automatically pick it up. You will see a message in your chat window telling you that you've picked it up.
Look elsewhere on the block—there are ammo boxes at the other corner. Go pick them all up by running over on top of them.
Find something to shoot at and let go!
After a short while, a new copy of the Tommy gun will reappear at the spot where you picked up the first one. Head back over there so you can admire your modeling handiwork as it gently rotates in the, errr
breeze. Yeah, a circular
There is also a primitive crossbow located on the bridge, if you are of the mind to go and check it out. Press the 1 key or the 2 key to switch back and forth between the weapons if you have more than one.
Just as we