Sunday, June 9, 2013

Creating a custom first person arms in Maya for Cryengine 3

                                         
                                  In this tutorial you are going to learn how to create custom arms for Cryengine3  in Maya. Actually I'm going to talk about how to export custom arms to Cryengine3. There are lot of tutorials which explain 3dmax and crengine3 integration. But I'm heavy Maya user, so I think this might be very helpful for Maya users.
                                  First you have to add joint for your arms. You can start with left side so you can mirror your joints later. If you don't know about the joint hierarchy please refer the cryengine3 documentation or you can download the source file by clicking here. This is the left side of the joint structure.
                           
                                 Mirror you joints. Right side is also the same except four item attachments. Replace L with R. Don't link the grenade_left_hand_dummy to toot joint. I think this joint is not important to have.
                                 Arms must be along with the +Z axis. Select your joints and go to cry tools. Click on the Zero Joint Rotations. Now you have to bind the skin to joints. Go to outliner and expand all the joints. Select joints except l/r_root, four item attachments, root and grenade_left_hand_dummy(if you are created this joint). Then Bind it. In here I use smooth bind with Max Influences of 3. Add IK Handler to upper arm and hand.

                               This is the smooth bind parameters which I used.
                         
                              Then move down the root joint(entire arm). -10 is suitable for me(in cryengine 3.4.5 you have to move root bone to world center and  upper arms, l/r roots...... to little bit downward). If you are not sure about the arm position create a camera on the grid with x,y,z position 0 and look through it.
                              Create a suitable directory for store your files(Crengine3/Game/Objects/ Weapons/Myarms). Go to crytek material groups window and add the material of the arm. My Material Group name is MyarmsMaterial.

                           Put your mesh under yourArmsName_group group and put that group under cryExportNode_yourArmsName group.

                            Select the group and go to crytek export window. Click Add Attributes and choose Character(.CHR) format. Give the path and click export. Then generate the material. Now you have successfully created the arm model.

                                        Then you have to modify the player.lua file. Go to cryengine3/Game directory and open Scripts.pak file in win rar. Then go to Entities/actor folder and extract the player.lua file. Open it in notepad. Search for fpItemHandsModel. Change the directory according to the file name and folder name.

fpItemHandsModel = "Objects/Weapons/Myarms/Myarms.chr"

                               Save the file and put it in to the same directory using winrar. Or you can create a same directory in explorer and save the file. Both are same.

                           Open the Objects.pak in winrar. Go to Objects/weapons/arms_fp and extract the arms_fp_Global.chrparams file. Open it in notepad and replace arms_fp with your arms name. Save the file in your arms directory.

                            Download the final part>>>>>
                            Now you are ready to go. Open cryengine 3 and play. You will see your arms are corrupted when you are using a weapon. Don't worry. After you create the animations for your arms and weapons it will be work perfectly. I will talk about how to add custom weapons and animation in my next post. Thanks.

1 comment: