Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu 3D Game Programming All in One- P20 docx
MIỄN PHÍ
Số trang
30
Kích thước
1.3 MB
Định dạng
PDF
Lượt xem
1458

Tài liệu 3D Game Programming All in One- P20 docx

Nội dung xem thử

Mô tả chi tiết

the midline of the tire are aligned with

the origin bug.

Testing Your Runabout

In order to test the runabout, we first

need to export it from MilkShape.

1. After saving your work, choose

File, Export, Torque Game Engine

DTS. You will see the Torque Game

Engine (DTS) Exporter dialog box

appear.

2. Use defaults, but make sure they

are correct.

You want to have Export animation

and Export material information

selected, and Collision Mesh should

be set to Collision Meshes (this is

automatic if the exporter finds a

mesh whose name starts with "Col￾lision"). Click OK when ready.

3. Export your runabout to DTS

format as C:\3DGPAi1\racing\

data\shapes\car\runabout.dts.

4. Open your wheel model and export

it as C:\3DGPAi1\racing\data\shapes\car\wheel.dts.

Next, you need to edit the script that controls the vehicle so it will look for your model

and not the default one.

1. Locate the file C:\3DGPAi1\racing\server\scripts\car.cs and open it with UltraEdit.

2. There are two lines that say this:

shapeFile = "~/data/shapes/rifle/weapon.dts";

Replace each of them with this line:

shapeFile = "~/data/shapes/tommygun/tommygun.dts";

3. Then find the line that says this:

shapeFile = "~/data/shapes/buggy/wheel.dts";

Testing Your Runabout 477

Figure 15.32 Seat mounts.

Figure 15.33 Collision mesh.

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

And replace it with this line:

shapeFile = "~/data/shapes/car/wheel.dts";

4. Save the file.

Okay, now it's time to run the racing demo. The following may look familiar to you, since

we did this back in Chapter 9.

1. Browse to C:\3DGPAi1 and click the Run racing Demo shortcut.

2. Click Start Mission.

3. In the Launch dialog box, make sure that the Multiplayer Mission box is cleared.

4. Select Car Race Track from the mission list.

5. Click Launch.

6. After the game loads, have at it! You probably should switch to Chase view by

pressing the Tab key—there's more to see. See Table 15.1 for the keyboard controls.

Moving Right Along

Building the model is only half the battle—well, maybe three-quarters. There is still the mat￾ter of defining the vehicle's characteristics, like mass, drag, speeds, particle generators, colli￾sion handlers, and so on. You take care of these things in scripts that run on the server.

To do the testing you just did, you used the existing demo buggy script that comes with

the Torque Engine and simply substituted our model in place of the dune buggy. It looks

like a roadster but drives like a dune buggy! In fact you will recall that you had a test-drive

of a dune buggy back in Chapter 9.

Later, in Chapter 22, we will create the script that will define the behavior of the vehicle

that we've modeled here and its response to user inputs and game environment stimuli.

Coming up next in Chapter 16, we'll continue with MilkShape and make some weapons

and other items.

478 Chapter 15 ■ Making a Vehicle Model

Table 15.1 Torque Racing Demo Controls

Key Description

mouse steering left or right

Up Arrow accelerate

Down Arrow brake

Tab toggle from first- to third-person viewpoint

Escape exit the game

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

479

Making Weapons

and Items

chapter 16

I

n this chapter we're going to make a bunch of things. Most of the techniques used will

basically be a review for you, so you can see this chapter as one big exercise in apply￾ing what you've learned to different situations.

We're going to make a few weapons, and in order to maintain balance, we'll make some￾thing that can be used in game to counteract the effects of these weapons.

We'll also make some items that one might call decorations for the game. The purpose of

these items—some trees and a rock—is to provide some clutter. This is to help fill out oth￾erwise sterile-looking game worlds, making them more interesting to wander around in.

The Health Kit

We'll start out with an easy one. Like I said, this will be a basic review, but it's important

to go over the process involved in creating an item for use in the game so that the broad

steps become obvious and second nature.

The Model

The Health Kit is little more than a fancy-looking box, as you can see from Figure 16.1. So

this won't take long.

1. Fire up MilkShape and create an empty document.

2. Use the Box tool to create a box, as shown in Figure 16.2.

3. Align the box to be centered at the origin for all three axes, as you can see in Figure

16.2.

Team LRN

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

Tải ngay đi em, còn do dự, trời tối mất!