First-Person Weapons

For CRYENGINE 3.4 you had a separate rig and mesh for first person. In 3.5 and beyond, first and third person are the same so this article does not apply to CRYENGINE 3.5 and up.

Overview for 3.4.x

DCC Tools

This documentation will describe the basic setup which fits to any of our supported DCC tools. The asset needs to be skinned to a hierarchy of bones which are following the natural movement of human arms. Each weapon will be a skinned geometry with its own hierarchy of bones and attachment helpers.

This document describes the process of creating a first person (FP) asset with character arms and the weapon. The system is based on an attachment feature which uses the character arm asset as the base. Each weapon will use the same skeleton as the base character arms so the skinned geometry for the arms can be always driven by each weapons animation to present the arms of the player. The character first person system is driven by xml and lua scripts to load animation and change values for each weapon for example.

All the main assets like the chr arms or the player chr need to be set in the Game\Scripts\Entities\actor\player.lua. You will see the registry for the agent arms asset and the chr at the beginning of the script. Each weapon (also hands without weapon) has its own xml script for setting up actions like shooting or ironsight zoom properties.

The Rifle is our main Weapon in the SDK and the script for it can be found for reference in the build Game\Scripts\Entities\Items\XML\Weapons\Rifle.xml (extract from the scripts.pak).

The Player Character's Arms Asset (.chr file type)

First Person arms Geometry


CryENGINE 3 in game asset placed as a geom entity for previewing.


3D package geometry

In this picture, you can see an example mesh of a pair of arms, which can be used for the first person arms of a character. The local transformation of the mesh should be zeroed out for all axes. Also, its pivot/center should always remain at the world center (Position 0,0,0; Rotation 0,0,0). Make sure that your asset does not have any history or transformation to be clean and ready for skinning to the hierarchy.

Keep mesh/geometry at the world center, with no rotation.

Arm Hierarchy

Below is the hierarchy that is used for deforming the arm's geometry. Note that the root, which is the top bone of the hierarchy, is also located at the world center and has no rotations applied.

Basic FP arms hierarchy includes:

  • Yellow: Root
  • Gray: Bones
  • Red: Red colored bones in the lower arms are twist helpers and are used to help the deformation around the wrist. They have a simple expression applied to them. Not important to have.

Schematic view of hierarchy

1st Person Weapon (.chr file type)

The Weapon Geometry

The weapon asset will be also a .chr file skinned to bones and helpers for attachments or animated parts.


CryENGINE 3 Scar weapon geometry placed as a geom entity for previewing


DCC Tool setup with helpers and bones

Tip

To make the weighting process more convenient, you can move away the parts which are meant to be animated later and should get their own bones, by a known amount of units or its multiples. Later, after you've applied your weighting modifier you can easily move them back to their original position by animating the bones they have been weighted to by the same amount that you moved them apart from the main model earlier.

For the geometry the same rules apply as were pointed out in the arms section. No translations should be applied to the geometry. The pivot should be aligned to the world coordinate center and the model should point in the positive y-direction in the Engine later on.

The Weapon Hierarchy

The hierarchy is pretty simple and straight forward. You just need to know that some of the bones need a specific naming convention which comes from the scripts (changeable if needed).

Weapon Term: Used to attach the muzzle flash effects and the spawn point of the bullet.
Shells: Used to attach the particle effect for the shells.
Collision: Used to determine the position of impact when used as a melee weapon.
Various attachment helpers, which are used to control the position of weapon parts. (attachment_top; attachment_side; attachment_bottom; etc)

Now it is time to link the weapon root as a child to the arms root. We have to make sure to always use the skeleton from the arms in order to attach them later on to the weapon. Each weapon needs the arms skeleton included as the main root. The weapons hierarchy starts at the weapon bone.

Exporting Skinned Geometry as a .chr file for the arm and weapon assets

Skin your geometry to the bone hierarchy and make sure that you follow the steps of the Character Authoring documentation to export the .chr file with the right directory and the registry in the animation.cba file if you are not yet familiar with the character export yet.

Exporting Weapon

The arms are skinned and exported from the root without the weapon hierachy linked.
The weapon however will have the arm hierarchy as the root since we linked the weapon root to the arm root. We only have to skin the weapon and the parts to their related helpers or bones under the weapon bone but for the export the Root will be the main node starting the hierarchy.

Animations for 1st Person Characters

The next step would be to animate the arms or the Weapon and export the animations like explained in the Animation section of the documentations. Please make sure that you have two different assets and they need their own chrparams and animation registries at the end.

For the animation names and the way how they got called from the system you have to refer to the scripts for each asset. The scar scripts for example can be found here Game\Scripts\Entities\Items\XML\Weapons\SCAR.xml. Basically you have to make sure to work with the scripts and the animations hand in hand to get to the final result later on.

Previewing your first person asset and animation in 3Ds max (also works for Maya) as an example

You can create a free camera at the world coordinate center which is looking in the direction of the positive y-axis. Enable in 3Ds max for the camera safe frames and set the vertical FOV (field of view) to the same value you use in the game, it becomes an accurate representation of what your animation will look like from the players view. The CryEngine uses vertical FOV that is really important to set it in 3Ds max or else you will not get the same view.

You can change the FOV as you like and match it in 3Ds Max later on.

r_DrawNearFoV

Sets the FoV for drawing of near objects.
Usage: r_DrawNearFoV [n]
Default is 60.

This setup also works for Maya the only important thing again is to match the FOV and to make sure to have a vertical FOV applied to the camera.