This article will guide you through the absolute basics of creating a weapon, exporting it and setting it up for use in CRYENGINE.
It requires (and only covers, for now) 3ds Max (though it's quite possible Maya/FBX process is similar for the most part), along with a basic understanding of it and CRYENGINE.
This article is by no means an advanced tutorial but its simplicity should clear up some impressions that getting a weapon into the engine is a difficult process.
If you have any feedback or particular questions about this tutorial or 'next-steps', you're welcomed to post here: CRYENGINE Documentation.
Creating Your Geometry
As mentioned, this is a very beginners article, and with that said, the author of this article only has very limited experience with 3D modelling. So we're going to end up with a box gun, but that means if I can do it, so can you!
Let's start by opening up a new scene. I like working with 'perspective + shaded + edged faces', but work with whatever you're most comfortable with:
Create a new 'Box' object (if you're familiar with CryDesigner/Solids, this should be fairly straight forward). Roughly 75cm(l) x 5cm(w) x 8cm(h).
Remember to setup your units first, if you haven't already!
Now the main part of our weapon is created, lets center it in the world by clicking on the move tool (keyboard shortcut: W) and then zero-out the coordinates in the bottom toolbar as pictured:
Weapons always point 'Y-forward' so the end of our barrel is towards the left of the image, the rear of the weapon is towards the right.
Let's now add some pieces of geometry that are going to make this weapon a bit more recognizable. Using the Box tool again, create a grip, a front sight and a rear sight.
Remember you can use the coordinates tools to place the created geometry exactly, for example, the front sight worked well at 0, 35, 8:
If you have an object selected and hold Shift and then move the object, this will prompt to 'copy' the object. This can be a quick way of adding new geometry.
While you're at it, make a Cylinder object for the barrel. You can then use the rotate function (keyboard shortcut: E) to turn it -90 degrees on the X axis and then align it (0, 37.5, 4) to the gun:
|Create a Cylinder object||Rotate and align the Cylinder|
Let's give our weapon an overview now to see where it's positioned in the world and how it's proportions look. Don't worry too much about this now, we'll adjust this more accurately later in-game.
Exporting The Weapon
Convert To Editable Poly
So far we've only been using standard "Primitives" which are the basic shapes, such as boxes, cylinders, triangles, etc.
We want to convert this weapon to an "Editable Poly". To do this, select the main section of the weapon, right click in the viewport and then select Convert To -> Editable Poly:
You'll notice the toolbar on the right side now changes and gives a lot more options.
First thing we'll do is merge all of these isolated pieces of geometry into one. To do this, have your main weapon "Editable Poly" selected, select the small box next to "Attach", select the other pieces then click Attach.
You can see now all the other objects disappear, colors are inherited and it's now all one piece of geometry.
Now is a good time to also rename our weapon to something more appropriate, like "newgun_tp" as we're currently creating the "Third Person" or "TP" version of the gun to start with:
Export To CGF
- Click on the Utilities tab.
- Click on "CryENGINE 3 Exporter" to open the Read this if you can't see it there. for the exporter.
- With the newgun_tp object selected in the viewport, click "Add Selected" to add it to the Export List.
- Check the "Export file per node" checkbox. Otherwise the filename of the exported CGF will be the Max filename, rather than the Node's name inside the scene. i.e; "newgun.cgf" instead of "newgun_tp.cgf".
- Click on "Export Nodes". If you haven't saved the Max scene yet, you'll be asked to do so now. Save the files to:
Note the "Cry_x_Node" nodes will automatically appear after re-opening the scene. They can be ignored for now.
If all went successfully then a dialog will pop up briefly during the export process and then disappear. Let's take a look at what it said though.
Clicking on the "Options" tab in the Exporter panel you can now select "Show Log":
All looks to be okay, no errors were shown and it has exported to the correct location, alongside the Max file.