In CRYENGINE, objects can be turned into pickables. The player can pick them up with one or two hands, carry them around, and drop them again. The picking behavior is dependent on the game script.
As an example, in the Crysis Game script there are two types of picking behavior:
One-handed: The player will pick up the object with his left hand and hold the object in this hand. The weapon in his right hand will still be usable. If the player holds a two-handed weapon, the weapon will be switched to the fists.
Two-handed: The Player will pick up and hold the object with both hands. The hands themselves will not be visible in the fist person view; also, no weapon will be usable.
A pickable object can be set up in a DCC tool by having:
To define the object's position on the in-game screen, a helper needs to be linked and aligned to the object. The presence of such a grab-helper in the object hierarchy turns the object into a pickable object.
In the one-handed pickup animation, the "item_attachment"-bone position is in the left hand of the player. For a two-handed pickup the bone is located in the center between the player's hands.
Use the "Local" coordinate system when adjusting the rotation of the grab-helper.
Setting up the Helper:
1. Open a Max scene and create a "Dummy" helper.
2. Name it "grab_onehanded_01".
3. Link the grab_onehanded_01 helper to the object.
4. Align it to the object.
5. Proceed with export.
Setting Up the Helper:
1. Open a Max scene and create a "Dummy" helper. Name it "grab_twohanded_01".
2. Link the grab_twohanded_01 helper to the object.
3. Align it to the object.
4. Proceed with export.
When a destroyable entity is destroyed, it will spawn pieces as well as a remaining object. These objects can be set up as pickables as well.
The process is equivalent to the one for one-handed and two-handed pickables, but the name of the object the helper that is linked to needs to be added as a prefix in front of the helper name (e.g. remain_grab_twohanded_01). A grab-helper for the non-destroyed version of the object ("main") does not need to have a prefix.
Basic Setup in 3ds Max:
In most cases the helper should be positioned below the object so that the player can see the object, since he cannot see his own hands in two-handed mode.
The pivot of these spawned pieces/remain that you can see in your DCC tool doesn't necessarily match the entity position in game. This means that placing the helpers for these objects could require a bit of trial and error. It is a good idea to always use the non-destroyed version of the object as a reference to align your helper.
4. Repeat steps 1-3 for all pieces/remains that should be pickable.
5. Proceed with export.
During Crysis development, Crytek developed an advanced technique to align one-handed grab-helpers to pickable objects in 3ds Max. There is a template file that contains the player's arms in the grab-pose that will be seen in the first person view of the game, and a camera that replicates the first person-camera of the game. There is also a grab helper included that is connected to a helper with a transformation-constraint. This makes it easier to rotate the whole template file and the grab-helper at the same time without unlinking the helper.
The key about this technique is to rotate the whole arms-template including the grab-helper, until the result looks as desired in the first person camera. The disadvantage of this technique is that the scene might become complex, especially if more than one template is merged into the scene. Efficient layer usage will become helpful for this.
Pickable helper template file: pickable_template.max
3ds Max Setup:
Example of a well-aligned pickable helper template:
Everything linked to this object including all the sub-objects/helpers will be exported into one file.
Setting up the Helper:
1. Open a Maya scene and create a locator. Name it "grab_onehanded_01_helper".
2. Insert the grab_onehanded_01_helper to the objects group node.
3. Align it to the object.
4. Proceed with export.
Setting Up the Helper:
1. Open a Maya scene and create a locator. Name it "grab_twohanded_01_helper".
2. Insert the grab_twohanded_01_helper to the objects group node.
3. Align it to the object.
4. Proceed with export.
When a destroyable entity is destroyed, it will spawn pieces as well as a remaining object. These objects can be set up as pickables as well.
The process is equivalent to the one for one-handed and two-handed pickables, but the name of the object the helper that it is linked to needs to be added as a prefix in front of the helper name (e.g. remain_grab_twohanded_01_helper). A grab-helper for the non-destroyed version of the object ("main") does not need to have a prefix.
In order to make your pickable object work in Sandbox, place it as a GeomEntity or any Entity that have "Pickable" and "RigidBody" set to true. "Usable" must be disabled.
Pickable objects-types are:
Non-AI-Characters can be set up to be pickable as well (animals for example).
In this case you need to use the Character Editor in Sandbox to set up the grab-helper attachment. You cannot do this in a DCC tool.
The grab-helper will be added to the character as a bone attachment. So, the orientation of the helper is dependent on the bone to which it will be attached. You don't necessarily need to apply an object to the attachment, but for easier alignment it is recommended to use an object with a clearly visible orientation. The object will be removed from the attachment later on when the desired result is achieved.
Attachment Creation:
In order to remove the object that was used as the helper for the alignment, open your .cdf file in Notepad and remove the object path. Repeat steps 4 - 7 until the desired result is achieved.
During the alignment:
After removing the object path in Notepad:
Changes on the pickable behavior of AI-Characters and procedural breaking environment objects have to be modified in the game code. For AI-Characters, the name of the bone which serves as a grab helper needs to be defined by game code. The grab position of pickable procedural breaking environment pieces is located on an offset to its pivot, which needs to be defined by game code
The easiest way to test how this is working is to place the asset, go in-game and then grab it by pressing F.
e_DebugDraw
Draw helpers with information for each object (same number negative hides the text)
1: Name of the used cgf, polycount, used LOD
2: Color coded polygon count
3: Show color coded LODs count, flashing color indicates no Lod
4: Display object texture memory usage
5: Display color coded number of render materials
6: Display ambient color
7: Display tri count, number of render materials, texture memory
8: RenderWorld statistics (with view cones)
9: RenderWorld statistics (with view cones without lights)
10: Render geometry with simple lines and triangles
11: Render occlusion geometry additionally
12: Render occlusion geometry without render geometry
13: Display occlusion amount (used during AO computations). Warning: can take a long time to calculate, depending on level size!
15: Display helpers
16: Display debug gun
17: Streaming info (buffer sizes)
18: Streaming info (required streaming speed)
19: Physics proxy triangle count
20: Display object instant texture memory usage
21: Display animated object distance to camera
22: Display object's current LOD vertex count