This is a comprehensive (and long overdue) tutorial on adding custom, animated weapons to CoD. The only two prerequisites to this tutorial are that you have Maya 8.5 with IW's xAnim/xModel Export Plugin or Maya 2012-2014 with Aidan's xAnim/xModel Export Plugin as well as an already completed weapon mesh to work with.
Open /bin/maya/model_src/modern_weapons/m16/weapon_m16.mb with Maya.
Open Outliner and expand the J_Gun tree. Hold Shift and select m16_high, then
select the last join in the J_Gun tree. Go to Modify -> Freeze
Transformations, then Edit -> Delete All by Type -> History. Now, in the
top left corner of Maya on the tool bar, click the dropdown box and select
Animation. Now select Skin -> Detach. Now select and delete all 3 m16 poly
groups.
Go to File -> Import and find your gun. It will be imported into the scene. Now you must bind the joints to the skin.
In order for the viewhands to know what to grab, and for the game to know what part of the mesh to move, you must bind joins to their corresponding meshes.
To this you must first
You have now finished the rig for this weapon. Save the scene in /Call of Duty World at War/model_export/ as weapon_gunname.mb. Go to the CoDWaW Plugin Menu and choose Model Exporter. If you don't see an Entry, click add new entry. Otherwise, continue.
Tick the box on the left next to 'Entry 1' and click the '...' next to the textbox. Locate weapon_gunname.mb and click OK. Now go to Window -> Hypergraph:Hierarchy and click+drag over everything in the black window. Zoom in and, while holding shift, click the first 3 items (cameras) so that they are not selected anymore (not yellow highlighted). Then click 'Set Exports' and tick the 'Force export joints' box on the Model Exporter window. Now click 'Export Selected Entities' and wait for the progress window to disappear. You can find the exported file in the same directory as the .mb.
Next you must create the viewmodel for your gun. This is the model that the user of the gun will see.
Open /bin/maya/animation_src/viewmodel/m16/m16.VMGun.mb in Maya.
Now we are going to do the same thing we did for the rigging: Open Outliner
again and expand the 'm16' and 'J_Gun' trees. Hold shift and select all items
within these two trees and go to Skin -> Detach. Now delete the 'm16' tree
and go to File -> Import. Locate your original, unrigged, unjointed model
again and import it. Do the same thing you did before: bind the joints to mesh
and create any new joints if necessary. Save the scene as gunname.VMGun.mb.
Now open the Model Exporter again and go to Window -> Hypergraph:Hierarchy.
Select everything as you did before, then in the Model Export window check the
Entry 1 box, locate your gunname.VMGun.mb, click yes to the popup window, then
press Set Exports and tick the 'Force Export Selected Joints' box. Press
Export Selected Entities. You will find the exported file in the same
directory as the .mb scene.
Now that you have your weapon rig (weapon_gunname.mb), it's time to do what will probably be the most simple step of this tutorial: making a gunsleeve. It is crucial to do this step correctly or your anim will never work.
The gunsleeve file is essentially an 'index' of all the joints and meshes involved in the animation. If the game cannot correctly identify all things in use, the anim will not play or the arms will be disfigured in-game.
To create the gunsleeve, first open your gunname.VMGun.mb (it should still be open if you are following this tutorial step-by-step). Now choose CoDWaW -> Viewmodel Tools -> Create new gunsleeve Maya file. If it prompts you to locate Viewmodel_DefMesh.mb, you can find it in /bin/maya/rigs/viewmodel/. Now, save the newly created scene as gunname_gunsleeves.mb. Open Model Exporter and tick the Entry 1 box. Choose your gunname_gunsleeves.mb file and then open Window -> Hypergraph:Hierarchy. Select everything and then press Set Exports in the Exporter window. Then Export Selected Entities. You can find the exported file in the same location as the .mb scene.
Animation process to be added here.
Save your animation scene as gunname_animation.mb. To export your anims, open the Animation Exporter from the CoD Menu. Open the Hypergraph and select everything as usual. Now in the exporter window, first 'Add new Entry' if there isnt one already, then tick the Entry 1 box. Now select gunname_animations.mb and enter the frame numbers of your animation in the boxes on the right. Now press 'Set Export Nodes'. It should recognize 'rig:' as the prefix. Now press Export Selected Entities. You will find a new file, .XANIM_EXPORT in the same directory. You MUST copy this file to /Call of Duty World at War/xanim_export/ (create this directory as it most likely does not exist yet). All .XMODEL_EXPORTS must be in /model_export/.
Now that you have all of your exported files, it's time to make them available to the game. Open Launcher, and from there click the Asset Manager button.
The first step in importing to AssMan is to set up your model's materials. Open your model in Maya and open Window -> Rendering -> Hypershade. Here you can see all of your shader names. You must create a mirror copy of each of them in Asset Manager. The material name must match the shader name. GO THOUGH PROCESS OF MATERIAL ADDING HERE.
After adding materials, you can safely add your weapon model. Scroll down to
'xmodel' and press New Entry. Give the model a name such as viewmodel_gunname
(although it can be whatever you want - keep it lowercase). For type, choose
animated
. In the first Filename box, locate your weapon_gunname.xmodel_export and
press OK.
Now go to PC Convert -> Current Asset Only. It should convert successfully.
Now scroll to 'xanim' and press New Entry. Give it a name representative to what it is an animation of, for example, viewmodel_gunname_reload_empty.
For Anim File, navigate to and select your .XANIM_EXPORT file.
For Model File, navigate to your gunsleeve .xmodel_export. Leave notetrack blank unless you know what you are doing. Uncheck Looping and Uncheck Use Bones. Change type to relative . Now select PC Convert -> Current Asset Only.
Now you must create a weapon file for your gun. You can use UGX WeaponsEditor++ if you wish, or copy/paste a treyarch weapon file and edit it to your needs. What is important is that you change the value for key 'gunModel' to your xmodel, and the value for the key of your desired anim to your anim name. Add the weapon file to mods/mapname/weapons/sp.
In order for your xmodel and xanim to show in-game, you must include them in fastfiles. Open Launcher and go to the Mod tab. Select your mod from the list and then add these lines to the ff box:
Note: Edit the names to match what you are adding.
Add the same files you included in your FF to your /mods/mapname folders.
Authors: UGX SajeOne, UGX treminaor & Darkmapper