Animating Weapons for Counter-Strike Source/Rigging the Weapon

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Open css-lr300-rig.exp. It should contain the hands (already rigged) and the weapon.



Adding Bones[edit | edit source]

Whenever you rig a weapon, ask yourself, "What movables parts are in this weapon?" In the LR-300, these are the components we will be using.

  • Frame/Body
    • Trigger
    • Bolt
    • Magazine
    • Shell Ejection Port

This is also the hierarchy of the rig that will be made.

  • To add a bone (in this case they will be called nulls in XSI), go to the left panel. Under the Get section, click the Primitive button, and click Null.
  • Navigate to the center of any viewport. You should see the null there.
  • Move the null to somewhere above the trigger of the LR-300.
  • Click the Scene button on the right. You should see null highlighted. Click it two times and rename it to Frame.
  • Repeat the above instructions for the trigger, bolt, and magazine. Fine tuning will be done later.
  • Now to fix the hierarchy of the nulls, click the Scene button on the right and click Frame. On the right section of the screen, under constraint, click Parent.
  • Open up the Scene Explorer again.
  • Now click trigger, bolt, and magazine.
  • Right click to finish the parenting process.
  • Now you must fine tune these nulls before you rig them, as it will we be unwise to edit them later.
  • Make sure these nulls are in the position you want them. This includes any rotation or scaling.
  • If you want to move only the Frame, you must select under the right hand panel, under Constrain, ChldComp. This button allows you to move an item without moving any of its children. Make sure that this is turned off once you are done.

Assigning Vertices to Bones[edit | edit source]

  • Click the LR-300 model.
  • Under the Animation left hand panel, (press 2 on the keyboard it should show green items) under the Deform section, select Envelope > Set Envelope.
  • You will get a warning dialog. Just press Yes.
  • Now open the schematic view of the rig by pressing 9 on the keyboard.
  • Some where you should see four green rectangles in the hierarchy of the rig. Drag a big rectangle around this using the left mouse button and right clicking.
  • Close the window that pops up.

Rigging the Frame[edit | edit source]

  • Click the LR-300 model.
  • Press Ctrl+E to open up the weight editor.
  • Click the column that says Frame at the top. The word Frame should turn bold.
  • Above all these columns in the center will be a bar. Click somewhere on it and drag it all the way to the right. It should say 100 to the left of it.
  • Now the Frame holds all the vertices of the rig.

Rigging the Trigger[edit | edit source]

  • There are two ways to rig the trigger. There is the vertex-hunting method and the painting method. In the vertex-hunting method you make a selection of vertices and assign them to a null. In the painting method you select a null and use a paintbrush to paint the vertices that you would hunt in vertex-hunting mode. For something as simple as a trigger, vertex-hunting is favorable.
  • Open the weight editor. (Ctrl+E)
  • Make sure the button that says Filter is not pressed.
  • Click the LR-300 model.
  • Change the selection filter to Vertex. (Click the button that says vertex on the top of the right side panel.
  • Now select one vertex of the trigger.
  • Now press SHIFT + = a few times to extend the selection of vertices.
  • Make sure that when you try to move the vertices, only the trigger moves.
  • Now open up the weight editor if it is not open already.
  • Click the word trigger so only it turns bold. (The other nulls should not be bold.)
  • Drag the slider just above the columns to the right all the way.
  • Now when you try to move the null of the trigger around, the trigger will move too. You can also rotate it.

Rigging the Magazine[edit | edit source]

  • The magazine is a simple set of vertices.
  • Try to repeat the same procedure for the trigger on the magazine. Just make sure you assign the vertices' weights to the magazine null.
  • Please make sure that when you make the selection of vertices, you test to see if you selected all of them as the SHIFT + = technique does not always ensure a complete selection.

Rigging the Shell Ejection Port[edit | edit source]

  • Rigging the shell ejection port should be done using the vertex hunt method.
  • Do some research to find out where is the shell ejection port.

Rigging the Bolt[edit | edit source]

  • Select the LR-300 model.
  • For rigging the bolt, we will use the vertex paint method.
  • Press 2 to bring up the animation panel on the left.
  • On the bottom of the panel, click the icon that looks like a paint brush.
  • Click any buttons that say Abs.
  • In the middle of this panel, there is a list of the nulls linked to the LR-300.
  • Click bolt. It will turn bold.
  • Next to the Abs button on the left, there is a palette button. Click it to start painting.
  • To change the size of the paint brush, change the slider that says Radius on the weight paint panel.
  • Painting is quite straightforward, but there are some limitations to this model.
  • The bolt is not quite complete on this model so paint enough of it so that when you deform the bolt it looks like its stretching backward. This is very difficult to explain, but basically when you move the null the top part of the bolt should be stretching back.

NOTE: Sometimes vertices will be very hard to access for painting. If this is the case, select the null you are painting as a normal selection. On the right hand panel under Transform, click Set Neutral Pose. Now move the null around so it stretches out and reveals a vertex that you can't easily paint. Go back to weight painting and paint it. Now select the null as a normal selection and go to Transform>Reset all transforms.

  • Save the file once it is fully rigged.

Congratulations! The weapons is now rigged. Next we will now learn how to prepare the models for exporting.

Animating Weapons for Counter-Strike Source
Preparing the Weapon for Rigging Rigging the Weapon Exporting the Models