Экспорт оружия

Материал из CryWiki Russia

Версия от 14:38, 20 июля 2011; DCamer (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
О статье
Автор[DBD]Mephisto03
ПереводчикDCamer
СложностьIntermediate - Advanced
СовместимостьВсе
Требования3ds Max, Sandbox2
Дата добавления07/07/2008


To set up a first person weapon and animation you will already need a Mods folder that contains the necessary folders and files for exporting. This would be the Bin32 folder and Tools/Maxscript folder. This is critical in getting models to export and animations to export at all.

Примечание:
The rest of the documentation assumes you have the correct needed files and folder structure and crytools working in 3DS Max when loaded.


Содержание

Exporting Weapon Model & Animations

Setting Up The Basics

  • There are a few folders and files that need to be made, used or modified to get a weapon model exported correctly and to work properly ingame. In this tutorial I will go through the needed steps in setting up all the files and folders for a basic weapon export. Basic means no attachments or different modes. The tutorial will follow me preparing a new shotgun for the game. This will include creating a third person object for ingame weapon identification. In the end I will have quite a few files created, modified or used, and will consist of:
 \Mods\MyMods\Game\Objects\Weapons\US\spas12
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12.max
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_fp.max
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_fp.chr
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_fp.cal
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_fp.mtl
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_tp.max
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_tp.cgf
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\spas12_tp.mtl
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\SCAR_L-C_fp.max


 \Mods\MyMods\Game\Objects\Weapons\US\spas12\textures
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\textures\spas12_DIFFUSE.dds
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\textures\spas12_DIFFUSE.dds
 \Mods\MyMods\Game\Objects\Weapons\US\spas12\textures\spas12_DIFFUSE.dds
 \Mods\MyMods\Game\Animations\Animations.cba
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\select_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\deselect_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\idle_right_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\fire_hand_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\reload_loop_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\pre_reload_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\post_reload_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\post_reload_02.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\melee_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\raise_right_01.caf
 \Mods\MyMods\Game\Animations\1st_person\weapons\US\spas12\lower_right_01.caf
 \Mods\MyMods\Game\Scripts\Entities\Items\XML\Weapons
 \Mods\MyMods\Game\Scripts\Entities\Items\XML\Weapons\spas12.xml


  • \Mods\MyMods\Game\Objects\Weapons\US\spas12

This is the folder I will create for the new shotgun (spas12) file that has been handed off to me by the weapons modeler. This file is the finished model with textures done for it.

  • \Mods\MyMods\Game\Objects\Weapons\US\spas12\textures

This will be the folder I keep all my textures for the weapon.

  • \Mods\MyMods\Game\Scripts\Entities\Items\XML\Weapons

This will be the folder I keep my spas12.xml file so its usable ingame.

  • \Mods\Mymods\Game\Animations\Animations.cba

This file needs to be added and modified to export animations correctly.

  • \Mods\MyMods\Game\Objects\Weapons\US\spas12\SCAR_L-C_fp.max

This file will be used to help export the new weapon correctly for first person so I have arms that can be animated with the weapon for ingame.


Before I Begin

  • Before I begin with exporting fp and tp models and animations what I will do is create or modify all the files that I won't be touching throughout the tutorial out of the way now so I don't have to worry about them later. This would include modifying the Animations.cba file, and creating the spas12.xml file.
  • If I don't have a Animations.cba file in my animations folder I can grab the original from the Animation.pak file and put it in my mods Animation folder. The "Animation Definition" for the spas12_fp.chr file needs to be called also to export animations correctly. I can get the required code for it by opening the Animations.cba file with Notepad or Wordpad. I will grab from </AnimationDefinition> to </SpecialAnimsList> for the Shotgun and copy/paste it under the shotgun since they are the same type (this is just done for personal reasons, it can be listed anywhere among the rest without incident). Here is what I added to my Animations.cba file for the spas12.


 	<AnimationDefinition>
 		<DeletePosController value="0"/>
 		<DeleteRotController value="0"/>
 		<Model File="/../objects/Weapons/US/spas12/spas12_fp.chr"/>
 		<Animation Path="1st_person/Weapons/US/spas12/"/>
 		<Database Path="1st_person/Weapons/US/spas12/spas_12.dba"/>
 		<COMPRESSION value="1"/>
 		<AUTOCOMPRESSION value="0"/>
 		<FOOTPLANTS value="NO"/>
 		<HUMAN value="NO"/>
 		<WEAPON value="YES"/>
 		<RotatePosRoot value="180"/>
 		<RotateQuatRoot value="IDENTITY"/>
 		<RotatePosChild value="180"/>
 		<RotateQuatChild value="180"/>
 		<SpecialAnimsList>
     </SpecialAnimsList>
     </AnimationDefinition>


  • The spas12.xml file I have is a simplified version of the Shotgun.xml file but slimmed down to only what I need it to do. In

the end, my new weapon spas12.xml will look like.

 <item name="spas12" class="Weapon" category="medium" priority="11">
 	<params>
 		<param name="giveable" 		value="1" />
 		<param name="selectable" 	value="1" />
 		<param name="pose" 				value="rifle" />
 		<param name="mass"				value="25" />
 		<param name="two_hand"				value="2" />
 		<param name="melee_attack_firemode"		value="melee" />
 		<param name="raiseable"		value="true" />
 		<param name="raise_distance" value="0.80" />
 		<param name="attach_to_back" value="1" />
 		<param name="bone_attachment_01" value="back_item_attachment_01" />
 		<param name="bone_attachment_02" value="back_item_attachment_02" />
 	</params>
 	<ai_descriptor handler="instant" burstBulletCountMin="1" burstBulletCountMax="10"
 		draw_time="0.5" sweep_width="1.5" sweep_frequency="2.5"
 		burstPauseTimeMin="0.8" burstPauseTimeMax="3.5" singleFireTriggerTime="0.4" />	
 	<ammos>
 		<ammo name="shotgunshell" extra="0" amount="8" minAmmo="3"/>
 	</ammos>
 	<geometry>
 		<firstperson name="objects/weapons/us/spas12/spas12_fp.chr" angles="0,0,0"/>
 		<thirdperson name="objects/weapons/us/spas12/spas12_tp.cgf" />
 		<boneAttachments>
 			<attachment target="firstperson" name="muzzle_flash_effect" bone="weapon_term" />
 			<attachment target="firstperson" name="muzzle_flash_light" bone="weapon_term" />
 			<attachment target="firstperson" name="muzzle_flash_smoke" bone="weapon_term" />
 		</boneAttachments>
 	</geometry>
 	<actions>
 		<action name="select">
 			<animation target="firstperson" name="select_01" />
 			<animation target="owner" name="select" />
 			<sound target="thirdperson" name="sounds/weapons:shotgun:select" radius="2" />
 		</action>
 		<action name="deselect">
 			<animation target="firstperson" name="deselect_01" />
 			<animation target="owner" name="deselect" />
 			<sound target="firstperson" name="sounds/weapons:shotgun:deselect" radius="2" />
 			<sound target="thirdperson" name="sounds/weapons:shotgun:deselect" radius="2" />
 		</action>
 		<action name="idle">
 			<animation target="firstperson" name="idle_right_01" speed="0.7"/>
 			<animation target="owner" name="idle" />
 		</action>
 		<action name="pickedup">
 			<sound target="firstperson" name="Sounds/weapons:weapon_accessories:pickup_weapon_fp"
                        radius="2" />
 			<sound target="thirdperson" name="Sounds/weapons:weapon_accessories:pickup_weapon"
                        radius="2" />
 		</action>
 		<action name="fire_cock">
 			<animation target="firstperson" name="fire_hand_01" />
 			<animation target="owner" name="shoot_cock" />
 			<sound target="firstperson" name="sounds/weapons:shotgun:fire%env%_fp"
                        radius="200" static="1" />
 			<sound target="thirdperson" name="sounds/weapons:shotgun:fire%env%"
                        radius="200" static="1" />
               </action>
 		<action name="reload_shell">
 			<animation target="firstperson" name="reload_loop_01"/>
 		</action>
 		<action name="empty_clip">
 			<sound target="firstperson" name="Sounds/weapons:shotgun:dryfire_fp" radius="2" />
 			<sound target="thirdperson" name="Sounds/weapons:shotgun:dryfire" radius="2" />
 		</action>
 		<action name="null_fire">
 			<sound target="firstperson" name="Sounds/interface:hud:null_fire" radius="2" />	
 		</action>
 		<action name="melee">
 			<animation target="firstperson" name="melee_01" />
 			<animation target="owner" name="melee" />
 			<sound target="thirdperson" name="sounds/weapons:melee:fire" radius="5" />
 		</action>
 		<action name="hit">
 			<sound target="firstperson" name="sounds/physics:bullet_impact:melee_impact_mw"
                        radius="5" />
 			<sound target="thirdperson" name="sounds/physics:bullet_impact:melee_impact_mw"
                        radius="5" />
 		</action>				
 		<action name="raise">
 			<animation target="firstperson" name="raise_%hand%_%suffix%01" />
 		</action>
 		<action name="lower">
 			<animation target="firstperson" name="lower_%hand%_%suffix%01" />
 		</action>
 			
 	</actions>
 	<firemodes>
 		<firemode type="default">
 			<fire>
 				<param name="ammo_type" value="shotgunshell" />
 				<param name="clip_size" value="8" />
 				<param name="rate" value="60" />
 				<param name="damage" value="75" />
 				<param name="reload_time" value="3.2" />
 				<param name="bullet_chamber" value="1" />
 				<param name="helper_tp" value="weapon_term" />
 				<param name="nearmiss_signal" value="OnNearMiss" />
 				<param name="damage_drop_per_meter" value="2.0" />
 				<param name="damage_drop_min_distance" value="15" />
 			</fire>
 			<recoil>
 				<param name="max_recoil"	value="8.0" />
 				<param name="attack" 			value="3.0" />
 				<param name="decay" 			value="0.5" />
 				<param name="maxx" 				value="30.0" />
 				<param name="maxy" 				value="0.5" />
 				<param name="randomness" 	value="0.5" />
 				<hints>
 					<hint x="0.2"	y="0.0" />
 				</hints>
 			</recoil>		
 			<spread>
 				<param name="min" value="2.0" />
 				<param name="max" value="4.0" />
 				<param name="attack" value="0.95" />
 				<param name="decay" value="0.7" />
 				<param name="speed_m" value="1" />
 			</spread>
 			<muzzleflash>
 				<firstperson effect="muzzleflash.Shotgun.Shotgun"
                                helper="muzzle_flash_effect" light_helper="muzzle_flash_light"
                                light_radius="2" time="0.500" light_color="1,1,0.8"
                                light_diffuse_mult="8" />
 				<thirdperson effect="muzzleflash.Shotgun.Shotgun_tp"
                                helper="weapon_term" light_helper="weapon_term"
                                light_radius="2.3" time="0.500" light_color="1,1,0.8"
                                light_diffuse_mult="8" />
 			</muzzleflash>
 			<muzzlesmoke_ice>
 				<firstperson effect="weapon_fx.gun.cold_steam_on_barrel"
                                helper="muzzle_flash_smoke" />  
 				<thirdperson effect="weapon_fx.gun.cold_steam_on_barrel"
                                helper="weapon_term" />  
 			</muzzlesmoke_ice>
 			<muzzlesmoke>
 				<firstperson effect="" />
 				<thirdperson effect="" />
 			</muzzlesmoke>
 			<reject>
 				<firstperson effect="weapon_fx.shells.shotgun" helper="shells" />
 				<thirdperson effect="weapon_fx.shells.shotgun" helper="shells" />
 			</reject>	
 			<shotgun>
 				<param name="pellets" value="5" />
 				<param name="pelletdamage" value="75" />
 				<param name="spread" value="8" />
 			</shotgun>
 			<actions>
 				<param name="fire_cock" value="fire_cock" />
 			</actions>
 		</firemode>
 		<firemode name="Shotgun" type="Shotgun">	
 			<shotgun>
 				<param name="pellets" value="10" />
 				<param name="pelletdamage" value="50" />
 				<param name="spread" value="5" />
 			</shotgun>
 			<recoil>
 				<param name="angular_impulse" value="0.2" />
 				<param name="back_impulse" value="3.0" />
 			</recoil>
 		</firemode>
 		<firemode name="Narrow" type="Shotgun">
 			<shotgun>
 				<param name="pellets" value="10" />
 				<param name="pelletdamage" value="35" />
 				<param name="spread" value="1.75" />
 			</shotgun>
 			<recoil>
 				<param name="angular_impulse" value="0.2" />
 				<param name="back_impulse" value="3.0" />
 			</recoil>
 		</firemode>
 		<firemode name="melee" type="Melee">
 			<melee>
 				<param name="helper" value="collision" />
 				<param name="offset" value="0.85" />
 				<param name="damage" value="65" />
 				<param name="impulse" value="30" />
 				<param name="delay" value="0.2" />
 				<param name="duration" value="0.35" />
 			</melee>
 			<actions>
 				<param name="attack" value="melee" />
 			</actions>
 		</firemode>
 	</firemodes>
 </item>


  • Now that I have the files I need modified or created for exporting and using the spas12 ingame I can continue onto the weapon exporting.

Примечание:
As you can see in the XML file I stopped calling a few bone attachments, all the zoom modes, layers, accessories and also cut out quite a few animations I wouldn't need for a basic weapon. I also changed the animation path to exactly the CAF files I'm going to be calling instead of using some of the special prefixes used by default. Also note I'm already looking to call spas12_fp.chr for my first person piece of geometry and spas12_tp.cgf for my third person piece of geometry. Lastly, instead of the default firemode also looking for the param "fire" in its shotgun actions section it is only looking for "fire_cock". This doesn't have any affect later on, just done for organizations sake.

Exporting Third Person Weapon Model

  • The first thing I'm going to do after getting a complete weapon model is have it set up into my file structure, spas12.max is saved in its respected folder location along with its textures. Next I'm going to open the file in 3ds Max, when I open the weapon model I can see its been broken up and also doesn't have a material assigned to it yet.
  • what I need for the third person model is to have it textured and put together. First I'll move all the separate pieces to their respectful spots. I'll go to the Modify tab in the Command Panel, select the weapon, select editable poly, and choose element.
  • Once the pieces are placed where they need to be I'll enter the Materials Editor by pressing shortcut "m". Once in I'll rename my material to spas12_tp, change the material type to Multi/Sub-Object, and set my number of sub materials to 1.
  • Inside the sub material first I'll change the shader to a Crytek Shader, select my textures in the Maps section as a bitmap, and assign the material to the weapon.
  • Once this is complete I'm going to save my file as spas12_tp.max since I won't be making any more changes. Next I'm going to create my MTL file with the Cryengine2 Exporter utility.
  • Once I 'Create Material' I'll add a new multi material by right-clicking in the hierarchy window and save it as the same name I have my material for the weapon in the 3ds Max Material Editor, in this case spas12_tp. Once the material is added I'll right-click again on the material in the SB2 Material Editor and add 1 sub-material. Here I will choose my textures for the MTL file in the Texture Maps section and close the window.
  • After that I will now make sure my weapon is selected for an object export, I'll check to make sure its exporting as a CGF file, and check that my export name is correct (spas12_tp). Once everything is checked I can safely export.
  • I'll check ingame now to make sure everything exported correctly for my third person weapon. We can see I now have a CGF file in the Character Editor that is seen and textured, and I also have a Geom Entity ingame textured.


Exporting First Person Weapon Model

  • The first thing I need to do is make sure I have the SCAR_L-C_fp.max file that came with the Example mod in my spas12 folder for my mod. Once thats secure I'll start my first person weapon model setup through that file.
  • Once inside I need to get rid of everything I'm not going to be dealing with. This would consist of everything except the arms and the camera. First what I'll do is select everything in the scene and change the animation timeline to read from frame 1 to 10,000. This will allow me to select all the keys in the timeline and delete them.
  • Once thats complete I'll hide my camera and select everything that deals with the weapon and delete them so all I'm left with is the arms.
  • The next step is to hide the rootL and rootR nodes and switch the arms from the root node so that they are facing the positive Y axis to allow correct orientation when exporting the CHR file later on. To do this I'll 'select by name' in the main toolbar and choose rootL and rootR, click ok, and then right-click and Hide Selection.
  • Now I can adjust the arms to where I need them. First I'll select the root node and with the transform handle chosen I'll use the x,y,z value boxes to change the y axis to its negative spot. I'll then choose the rotation handle and adjust the z axis 180 degrees so the arms face the positive Y.
  • I am now ready to bring in the weapon. I'll select 'XRef Object' in the file menu and then click on 'Create XRef Record From File' button and select spas12.max and select spas12 as my object and click ok. I now have my weapon in the scene.
  • Since the original file already had the object centered correctly and in the right proportions I don't have any modifying that needs to be done to the weapon. I will check the objects name (spas12) and rename it spas12_fp since it will used as my fp weapon. I'll also convert the weapon to a Editable Poly.
  • At this time I will start setting up my dummy nodes as attachments so that I can link them together with physique in a little while to parent each piece of the weapon together.

Примечание:
If you look at the SCAR_L-C_fp.max weapon and how its set up you will notice the main stuff thats being animated like the trigger, magazine release, reload cock ect. are bones. Attachments used for modifying the weapon like scopes, silencers, flashlight ect are set up using dummy nodes. In this tutorial I will be making the animated pieces linked together with dummy nodes. This won't affect use ingame, exporting, or with animating. On a lighter note, first person animations never actually pull the trigger.

[Alternate Image Link]

Примечание:
I need to have two dummy nodes per piece I'm going to be using as an "attachment", this is because the 'tip/front' node will be used to link the vertex points of the object, and the "base/back" node tells where the piece is located and allows the the user to transform/rotate the piece without affecting the actual geometry and cause stretching. Once I have all my dummy nodes in place I'll rename them to something more appropriate.

The dummy node at the tip of the weapon needs to be named "weapon_term" as this is the "Bone Attachment" that the XML file looks for so that I have muzzleflash and smoke when I fire the weapon.

In the picture you will notice that the piece to reload the shotgun and the shell ejection piece are one attachment. This was done on purpose as both are animated together, so those two pieces will become one attachment.

  • The next step will be linking the dummy nodes together so that when the physique modifier is applied it will create a correct hierarchy. I will first select my weapon and freeze it so its not in the way of the linking process.

Примечание:
You can see the shoulder piece is being linked (dotted line) from the 'tip/front' node (white) back to the 'base/back' node of the shoulder piece (green)

The "weapon_term" node will be linked to the "collision" node at the butt of the weapon, that is then linked with the "weapon" node placed around the axis origin (0,0,0) which is then linked to the "root" node of the arms. All the other pieces are linked appropriately from the 'tip/front' node of the piece to the 'base/back' node of the piece which is then linked to my "weapon" node.

Remember to unfreeze it when you are done.

  • Once that is complete I will now add a physique modifier to my weapon and click 'Attach to Node' in the Physique section and click on 'Select by Name' on the Main Toolbar and pick the root node. A Physique Initialization window will come up and I'll select rigid from the Vertex - Link Assignment section and click Initialize. I will now see a bunch of lines that stretch from my arms "root" node to all the appropriate pieces in the correct hierarchy.
  • The next step will be assigning the vertex points to the right links. With my weapon selected I will select Physique in the Command Panel and select Vertex. I'll drag select all the vertex points of the weapon (which will turn green and look like a cross) and in Vertex Options of the Command Panel click on 'Remove from Link'. Next I will drag select the workspace area again (which will turn the yellow link lines red), select 'Rigid Vertices' (large green cross) and then again drag select all the vertex points in the workspace (this will turn all the vertex points blue).
  • I haven't actually assigned anything to a link yet, This time I will click on 'Select' and click in the workspace to deselect everything I have (all my Vertex Type buttons are now all highlighted). Now I will select only the vertex points that are part of the main piece of the weapon. Next I'll click 'Assign to Link' and choose the link that goes between the "weapon_term" node and "collision" node (the main weapons vertex points turn green while all the rest of the weapons vertex points are white). The links will be colored appropriately also, the link that the vertex points have been assigned to will be red, while the others are yellow. Once this is complete I will click on 'Lock Assignments' which will turn the crosses the vertex points have been to boxes.
[Alternate Image Link]
  • I'll now repeat this process with my other weapon pieces by hitting 'Select' again and drag selecting each piece and assigning them to their links and locking them. This would be the ones that stretch across the piece I'm attempting to assign a link to, not the one that connects to the "weapon" node from the 'base/back' node were linking. In the end, all the pieces should now have boxes as vertex points instead of crosses.
[Alternate Image Link]
  • I now have one more thing I need to do before I can create my MTL file and CHR file. That would be assigning the textures to the weapon. I'll repeat the same steps I did earlier for setting up my material for the third person weapon inside 3DS Max and save the file as spas12_fp.max.

Примечание:
You'll have other materials that have been made because of the SCAR and its attachments, just leave them be, they won't be in your way. If you have texture issues after assigning the material to the weapon make sure you assigned the Diffuse map to Show Standard Map in Viewport because it might just show the last entered texture (bump)

  • First I'll create my MTL file, I'll follow the same steps I did earlier when I used the 'Create Material' for the third person weapon.

Примечание:
Remember the MTL file needs to be named the same as your 3DS Max materials name. CryEngine2 Exporter does not save the MTL file with any uppercase letters.

  • Once that is done I can export my weapon as a CHR file. I will now make sure my weapon is selected for an object export, check to make sure its exporting as a CHR file, and check that my export name is correct (spas12_fp). Once everything is checked I can safely export.
  • I'll check inside the Editor now to make sure I have a visible weapon, with textures, and arms with the CHR file. The file has been exported correctly with textures applied and arms that can be able to be seen when I start animating.

Примечание:
To see arms with the CHR file all you need to do is create a new skin attachment and as your object use the objects/weapons/arms_global/arms_nanosuit_us.chr file without a MTL file. Click apply to have them appear.

  • I now have a third person and first person model thats textured to be used ingame. At this time if I wanted I could place a spas12 entity into my scene that I can pick up. What I would see though is nothing, as the object is behind the camera and facing the opposite way (remember I switched the orientation of the weapon and arms at the beginnig). What I need to do now is set up the weapon so it can be animated correctly.


Exporting First Person Animations

  • Now that I have all the files I need I'm missing 2 more things, this would be the animations, and also the CAL file. First though I will clean up the 'Export File per Range' list that is looking for the old set of animations for the SCAR that I deleted when I first entered the file. I'll go to the Timing section in the CryEngine2 Exporter and click 'Edit Sub-Ranges', here I will see a list of animations that were being called for the SCAR to export. I will be remaking most of these, but for now, I'm going to clear the list as my keyframes will most likely differ in length and order.
  • Next I can start setting up the weapon for animating. To do this I'll select 'Auto Key' under the Timeline and repose my arms "root" node back to where it originally was, facing the negative Y axis. This would consist of setting the transform Y axis back to a positive number, and rotating the Z axis back 180 degrees.
  • Once I do that I will select the weapon and right click and go to 'Object Properties' and uncheck 'Show Frozen in Gray'. Once that is complete I will freeze the weapon. From now on any time I need to move the entire weapon I will use the "weapon" node. If I need to move a piece of the weapon I will use one of the 'base/back' nodes that corresponds with what I need to move.
  • Finally before animating I will move all the separate pieces to the spots they need to be on the weapon.
[Alternate Image Link]

Примечание:
At this time I now have a weapon completely ready to be animated. If your on a mod team the weapon can now be handed off by the Lead Animator to one of its animators to work on animations for the weapon, or if the modeler is setting up the weapon for the animators, this would be the point that the modeler should hand off the files to the animator for animation creation. From this point on all I would be doing is animating the weapon.

  • The first thing I'm going to do is adjust the position of the weapon so that its in a spot that actually is useful for playing, and not in the middle of the screen. I'll select my "weapon" node and move it to the lower right corner of the camera. I'll also grab the left arm by "upperarm_NEW_L" and place it where I need the arm to be holding the weapons neck.
  • With the initial pose now done I can start creating the 11 basic animations I need to make the weapon seem seamless ingame. As an example I will create 2 new animations "fire_hand_01" and "select_01". To do this is very easy. First I'm going to change the timeline to be from frame 1 to frame 20. Then to create the firing animation all I'm going to do is select the arms "root" node, and copy/paste the key from frame 1 for frame 6 and 10 also. For frame 3 I'll translate the "root" node back a little, and on key 7 I'll rotate the "root" node down out of view.
  • I now have 2 animations, One from frame 1 to 6 which will be the weapon firing, and one from frame 7 to 10 which will be selecting the weapon from inventory.
  • I can now go back into the CryEngine2 Exporter and in the Timing section check 'Export File per Range'. Next I'll click 'Edit Sub-Ranges' and I'll add one animation from frame 1 to 6 named "fire_hand_01" and another from frame 7 to 10 named "select_01". The last thing to do is check that the Bone Export is exporting from the "root" node, click 'Export Bones' and save the CAF files into my spas12 animation folder.

Примечание:
Exporting the .CAF files to a different directory than the default one can cause the animations to be rotated 180° ingame. Just export your Animations where MAX wants to and then move them into the proper folder if you encounter this kind of problem.

-Vert-X

[Alternate Image Link]
  • The final thing I need to do is check to see if everything works fine in the editor. First though I need to create my CAL file so that they are loaded with my new first person weapon.
  • Now I'll check ingame to see if everything is working. As we can see the weapon is in as a entity, the animations are seen in the character editor, and also its working as a fp weapon ingame.
[Alternate Image Link]
[Alternate Image Link]
  • And thats its, I can focus on the rest of my animations. Hope you find this tutorial useful.

Примечание:
Issues will still be present, especially for third person view since the new weapon is still categorized as a shotgun and will use the shotgun animations for its tp animations. Look at this as a guide.

Credits

Slaughter - First Person Weapon tutorial creator, [DBD]Mephisto03 - Wiki tutorial author


See Also

CAF File

CAL File

What is the SDK?

Creating New Animation Entry

Weapon - Setup and Export (Video Tutorial)