Targetware: 3D Dev Guide
Creating the .ANM File
Now your parts are exported, you can build an .anm file to assemble them.
Create a new directory in your mod's planes/ directory. TR: use /data/tr/planes/, TK: use /data/tk/planes/. Name it with an abbreviation of your plane. Some examples:
|
|
a6m3_22
|
(A6M3 Model 22)
|
|
|
b5n2
|
|
|
|
ki-44
|
|
|
|
beaufighter
|
|
|
|
f4u-1
|
|
|
|
p-40n
|
|
For our example, let's say we are building an A6M2 Zero. The first thing to decide is whether we're going to share the same directory for all variants (if any), or if we're going to use separate folders. For our Zero, we've decided to use separate directories for each variant. This will prevent someone who only downloaded the base skin package (1 default skin per plane directory) from seeing an A6M2 skin on their A6M3 Model 32 with it's short wings. If your plane shares largely the same geometry across it's variants, it is less important to split the directories up. We're going to name our directory "a6m2". Note that all files names are in all lower-case. Allowing mixed case file names could be confusing later on.
So now we have an empty directory: /data/tr/planes/a6m2/
Start up your favorite text editor. Create a new empty file, and save it in your new directory. Name it something indicative of your plane, like "a6m2.anm" or "f4u-1a.anm".
The next step is to edit the FM (.acm) file for your plane. Locate your plane's .acm file in the /data/<my mod directory>/planes/ directory. For our zero, it's named 'a6m2.acm'. Open the file in your text editor. Look for the lines near the top similar to these:
|
|
[Graphics]
external = a6m2/a6m2.anm
|
Edit the 'external = ...' line to point to the .anm file we just created. Now the game will know where to look to find the graphics for your airplane.
Go back to the .anm file, and, using the following lines as a model, type in a header section for your file:
|
|
[Object]
name = forward fuselage
geometry = a6m3_fuse_center.lwo
offset = 0, 0, 0
rotation = 0, 90, 0
num_path = 0
num_children = 28
|
Let's look at each line in turn. The name line matches the name of the section of the fuselage containing the pilot, as described in the .acm (FM) file for the airplane. If this name doesn't match up with the .acm file, we will not be able to show damage effects on this part of the aircraft. The geometry line points to the 3D file that represents the 'core' of your airplane. This should be the part containing the cockpit. The settings here affect all child object that follow.
The offset line tells the game where to put this part in relation to the 3D mesh's point of origin. We have already set the plane up with the right point of origin, so for our core part, we'll use "0, 0, 0". In fact, for all the parts we exported in Step 1 above, we'll use "0, 0, 0", because we exported them in-place. Later, when we add parts that require animation, we'll plug numbers into the offset line. NOTE: The offset line numbers are in meters.
Use the rotation line to correctly orient your plane in Targetware space. The line above works for objects modeled in Lightwave, other modeling programs may require different settings. Experiment until you get the right numbers.
The last line, 'num_children' defines the number of "child objects" (parts) associated with your plane. In the case of our A6M2, we have 28 different parts that need addressing in the .anm file.
That's it. Try duplicating the code above for your plane, and adjust it until you can see your center section displayed in game. You should see something like this:
Illustration 2.63_1: A plane with no child objects assigned
|