Milkshape Modeling Tutorial for Return to Castle Wolfenstein Part III – Animation

So, what about animation? Can’t we make cool animated models? You sure can!

Load up your .msd3 model that we made before. We’ll load up the helicopter again. Now I think it would be cool if we animated those rotor blades so they spin around like a real helicopter. Sounds cool huh? Where do we begin?

First of all we need to learn about joints. What’s a joint? A joint is just like a vertex point. Except that two joints define a bone. What’s a bone? A bone is a line between two joints. Think you your own joints. You have them at your elbow and your knees, and in between the joints are your bones.

Well, why do we need joints and bones? The joints define the bones, and the bones, when linked to the model, will make the model move around by moving the bones.

.Md3 files don’t actually save the bones and joints they save the vertex points in their different positions as the animation frames.

Let’s start placing some joints then.

Go to the Model tab on the right and click the Joint button. Feel free to check the “redraw all viewports”. This box allows all the 4 square ortho/perp views of the model to be redrawn simultaneously as you work on the model.

Now let’s zoom in on our big rotor blade on the helicopter. We’ll point a joint right in the middle. Mine looks like a red X with a circle around it. Check your other views though, that joint might not be where you think it is! Mine looks O.K. from the top but it’s actually below where it is supposed to be. We’ll need to move it.

That’s easy. Just click the “Select” button and then the smaller “joint” button at the bottom. This will allow you to select a joint. Now select it and click the “Move” button to move the joint where you want it to be.

Great! We put in a joint. Now what….?

Click on the Joints tab to go to the joint controls. Here we see a whole new list of buttons. These buttons aren’t too hard though. Notice in the white box it says “joint 1”. That’s your joint! But it really should have a more descriptive name. Let’s call it…. rotorcenter. So in the little edit box on the right type in the name and then hit the “rename” button. It’s just like naming a group.

Oh, make sure the checkbox “show skeleton” is checked or you will not see any of the joints or bones.

Now we have a joint at the center of the large rotor blade assembly. Good. Now ye need to put another one at one of the tips of one the blades. Do this by going to the tip of one of the rotor blades and adding another joint. What happened? A blue line appeared between the center of the rotors and the joint you just placed. That blue line is a bone. You defined it when you placed the two defining joints.

We want a bone for each rotor so we can move the rotors.

At this point you’ll want to notice that selected joints are red or green and unselected joints are blue.

Go back and rename the joint you placed. We’ll name it blade1.

Put another joint at the end of the second blade. Wooops! There is a blue bone extending from the tip of blade1 to blade2! That’s not what we want! Hit Control+Z to undo the joint placement.

It is important to know that when you are placing joints, you are really defining where the bones are going. The computer will place a bone between the joint you are PLACING and the joint you have SELECTED PREVIOUSLY. Because the joint we had selected previously was the one on the tip of blade1, the computer thinks to draw a bone between that joint and the one we are placing.

What we really wanted, however, was a bone from the center of the rotor assembly to the end of blade2. We need to select the joint at the center of the rotor assembly. You can do this by either 1) clicking the name of the joint under the Joints tab or 2) use the select button + “joint” (at the bottom) under the Models tab – left click to select. So, anyway, select the joint at the center. It should be red. Now go back to the Model tab and click the Joint button. Add a joint to the tip of blade2. Great!. You’ll notice that there is a bone extending from the center to the end of blade2. This is what we want.

Keep doing this for blade3 and then we’ll also do it for the tail rotor. Remember that a bone is defined when you have a previously selected joint and then place a joint. If you deselect everything, there should be no previously selected joints and you’ll be free to place a joint that is not connected to anything.

I don’t know if you have been noticing, but every time you select the center joint the bones turn green.

Go back to the Joints tab and now click on the center joint for the rotor assembly. You’ll notice that the center joint is red but the other 3 joints and bones are all turned green. If you click one of the joints on the tips of the blades, only that joint turns red and the bones are blue….

What is happening here is that the center joint is the parent joint for that group of bones. It’s like the daddy joint. Think of it this way. Can you move your foot without moving your leg? Yes. Can you move your leg without moving your foot? No. That’s because the foot is attached to the leg and moves with it if the leg moves. That’s the idea here. You can move a blade individually through the joints at the tips (try it), but you can’t move that center joint without moving the other three (try it).

Whenever you select a joint, it will light up green any bones that it is the control joint for. Not to get too complicated, but you can have more than one control joint for a bone. Think of it like this. Can you move you foot by moving you leg? Yes. Can you move you foot by moving your hip? Yes. So both of them can control the foot. We don’t have that situation here though.

 

Flesh and Bone

Wonderful! We have all these bones. We have control joints. Are you excited?

We now have to like the bones to the model itself somehow. It will help if you right click on the 3D view and select “wireframe” at this point.

O.K. here comes another example. If we have the bones for the leg, and we have the model of the leg, we would need to first select all the vertex points that make up the leg and then select the control joint (at the hip) which controls all the bones for the leg and then link them together.

Let’s just do it. First you need to select the control joint for the rotor blades (i.e. the one that make all the other joints turn green). Now you can select the vertices that those bones are going to move by either 1) going to the Groups tab and finding the groups you want then clicking the select button to select them (recommended), or 2) selecting the vertices from the ortho views using SHIFT + left click and drag (for selecting individual vertex points).

What you should see is a bunch of green bones and a lot of red vertex points around those bones. You must have the vertex points AND the bones selected. Now go back to the Joints tab and with all of this selected click the Assign button.

That’s it! You assigned bones to the rotor blades! Just to make sure you did it right you can select the control joint again in the box under the Joints tab and then click the “SelAssigned button”. This shows you the vertex points that are assigned to that joint. The other button next to it, just so you know, that says “SelUnAssigned, of course”, selects all vertices that are NOT assigned to joints/bones.

If you royal screwed up you can disassociate the joints/bones from the vertex points. To do this select the vertex point that are assigned to a bone and under the Joints tab click the “clear” button. This clears any associations for those vertex points.

Go ahead and assign all the vertices for the tail rotor to the control joint for the tail rotor.

At this point I would save the model.

I like to move it, move it!

MY GOODNESS! This is tough work. But now comes the payoff. The animation.

Now that we have bones and vertices working in tandem harmony, we need to make them move around.

See that button at the bottom of the screen there? The one that says “Anim” that I told you to ignore at the beginning. Well click it. That brought to life a few buttons at the bottom and a ticker/slide bar on the bottom. There are also two boxes with numbers.

The two boxes are the starting frame (which should be 1) and the ending frame (in the second box). Type a number in for the second box. Notice that the number of tickers increases on the slider bar. This leads us to the conclusion that each ticker on the slider bar is an animation frame. We are going to use 18 animation frames.

Type 1 in the first box and 18 in the second – if it is not that way already. You’ll notice 18 tickers on the slide bar. Good. Now go to the Animate menu and you’ll see a bunch of “keyframe” commands. Each ticker on the bottom of the screen is a keyframe. What you need to do is set the bones in different positions at each keyframe. Then you save that keyframe. Notice here that under the Animate menu you can copy a keyframe or delete one too. This is really copying or deleting the positional information for the bones at that keyframe.

We want to store the current position of the bones as the first keyframe. So go to the Animate menu and choose Animate->Set keyframe. You can also use Control +K.

Good keyframe 1 is in place. Move the ticker to the second notch. You’re now on keyframe 2.

Go to the Joints tab and select the control joint for the main blades. All the bones should light up green. Now go to the Model tab and click the Rotate button. We only want the blades rotating in the Y direction so “unpress” the X and Z buttons. Now type in 20 in the space above the Y. You’ll notice that the numbers related to degrees of rotation. If you type in 360 and then hit rotate – nothing will happen (i.e. it rotated 360 degrees).

O.K. so rotate the blades 20 degrees in the Y direction. Good. Now go back to the Joints tab and click on the control joint for the tail rotor. This time we’ll rotate it –20 degrees in the X direction.

Once you have rotated both the tail rotor and the main rotor, go to the Animate menu and click Animate -> Set Keyframe. You’re doing it! Yes. Keep on rotating 20 degrees and saving the keyframes.

It’s helpful to check you progress by sliding the ticker back and forth to watch the animation to look for mistakes in the keyframes. You’ll see that only one of the 4 views will do the animation. This is why it is good to use the 3-window view instead of the 4-window view now. You can go to Window -> Viewports-> 3 Window (…) to choose the 3-window view. Now click on the 3D view and then try the ticker/slider again. It should animate in the 3D view.

When your done you can play the animation by clicking the play buttons next to the big Anim button. These buttons let you play in reverse/forward/by frame etc. There is no stop button because you just press the button again to make it stop.

You don’t want the last animation frame as the first frame or else you rotors will pause at frame 1 for a second. So only go up to a rotation of 340 degrees. The next frame will loop back to 1 (360 degrees) and the animation will look naturally when looping.

Neat. Your chopper is animated.

Hey did you notice that the bones are yellow now? That means they have animation associated with them.

Oh, you can view only a section of the animations if you want. Just press play and then type in the numbers of the animation frames you want to see. So if we only want to see what it looks like for animations 5-12 only, we would press play and type in 5 and then 12 in the number boxes.

 

Getting it to work

Well I think it’s time to export this puppy and get it animated in wolfy!

Be sure that before you save your model is textured! I think it might be a bug but the model doesn’t always load the texture properly. Go in the 3D view and right click. Select “textured”. If no texture appears in the model you can go to the Materials tab and just reload the texture. It should still skin the same. Milkshape needs to reload the texture is all.

The other important thing to do now is to move the entire model near the XYZ colored axis. You’ll need to know where this axis is, later on, in relation to the model. You could (in this case) make the XYZ colored axis flush with the ground or you could put it at the center of the model. As long as you know where it is in relation to the model. This is actually easier said then done. To move the model AND the bones together you’ll need to select all the faces and then go and click on “Select” and “joint” under the Model tab. REMEMBER that to move the bones together you deal with the control joint ONLY. While holding shift, left click on the control joint for the large rotor and then the tail rotor. With all this selected you’re now able to move the model. You can not rotate the model, however, or the bones will become misaligned. The best way to avoid this mess is to make sure the model is correctly aligned with the xyz axis before doing any animation. It’s o.k. though.

Save the model as a .ms3d just in case.

Now we need to generate the control file again. This time we need to make 1 change from last time. In the $frames section you will write the two numbers that are in the animation boxes near the Anim button. In this case it will read “$frames 1 18”. Everything else is the same from last time.

Save the .qc file (the control file). Now export the model as an .md3 Quake III arena model with the same filename as the .qc file.

Great! You have an animated model to add to Wolfenstein. Now we just need to get it to work in radiant.

Load up GTKRadiant and in one of the graph paper views right click and select Props -> props_decoration. A grey box appears. Bring up the entity window.

In the entity window you’ll need to enter a few keypairs. Add the following:

      “model2” “add the path name to the model” – my model had the path models/mapobjects/heli/heli.md3

 

      “frames” “the number of frames” – our case 18

 

      “startonframe” “the starting animation frame” – our case 1

 

Now you’ll also need to check the boxes “animate”, “starton” and “looping”. These boxes will allow our model to be animated, it will allow the “startonframe” keypair to work correctly and the third box allows the animation to loop.

You can also do some other things too. The “startinvis” will allow the model to start as an invisible model and appear when triggered. Also the keypair “loop” will allow the model to loop from a certain frame. Good for a slow starting propeller that loops at high speed, for instance. You can also assign the animation a sound as well.

Notice that the model doesn’t actually appear. That doesn’t matter – it is added in-game. What does matter is that the grey box that represents your model is exactly where the XYZ colored axis happens to be in your model. So wherever you place the grey box, that’s where the XYZ colored axis will be placed in the model. This is why it’s important to know where that axis is in relation to the model before you export it.

Well, bsp your map and load up wolfy. Turn around and there it is! Your moving, animated model!