Friday, February 7, 2014
Exporting a custom weapon for cryengine 3.5.x using Maya
In this tutorial I'm going to talk about how to import your weapon to cryengine 3.5. I'm going to talk about the basic exporting process, not the Mannequin set up, so later you have to create your own weapon animations and set them up in the Mannequin to work it properly. But without those animation this will work fine but animations like reloading gonna be little bit messed up because we are using default animations which are created for the default rifle.
First you need to import your weapon to Maya. The weapon should face in the positive z direction. Move your weapon little bit downward and forward. Then create 2 cry export nodes. One for the weapon and the second one for the magazine. Then group your objects to the 'cryexport' nodes. Export file type of the weapon should be CHR and the magazine should be CGF.
Then create the joints according to following structure.
magazine and magazine2 joints should be in the same place. Set the magazine geometry's (not the magazine group) pivot to the magazine joint (d+v) and apply Fixup Node Origins to the magazine.
Then apply Zero Joint Rotation to the all joints. This process is very important. Select the weapon joint and then shift select the all the objects except lever, safety and magazine and smooth bind them (Skin->Bind Skin->Smooth Bind). Set the following attributes and click bind skin.
Bind the safety as well as lever but don't bind the magazine. Set the location of the magazine to world zero. Your final scene looks like this. Create the materials and export the objects and the materials.
Then extract the CDF and CHRPARAMS file of the rifle and rename them. Change model path and the material path in the CDF file. Change the magazine path in the CDF file. In here I'm using the same weapon directory for the magazine. You have to change the CHRPARAMS file if you are going to use custom animations.
Extract the rifle.xml script and rename it. Change the item name, display name and the geometry path. Now you are ready to test your weapon. If you are going to use custom animations there will be little bit hard work to do with Maya and the cryMannequin.
You can use muzzle flash, shells, proxies but I'm not going to explain it here. You can download the final+sample file by clicking here. As I said before this the basic process and sorry for the bad weapon model. Hope you guys enjoy it. Thank you.