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

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

Перейти к: навигация, поиск
Эта страница страница помечена как находящиеся в процессе перевода.


О статье
Автор[DBD]Mephisto03
ПереводчикDCamer
СложностьСредне — Сложно
СовместимостьВсе
Требования3ds Max, Sandbox 2
Дата добавления20/07/2011
Последнее изменение27/07/2011


Чтобы настроить оружие и анимацию от первого лица, вам понадобится папка Mods, содержащая необходимые папки и файлы для экспорта. Это будет папка Bin32 и папка Tools/Maxscript. Это имеет решающее значение в получении моделей для экспорта и анимаций, и экспорта вообще.

Примечание:
Остальная документация предполагает, что у вас есть правильная структура необходимых файлов и папок и установленные CryTools в 3ds Max.

Содержание

Экспорт модели и анимаций оружия

Основная настройка

  • Есть несколько папок и файлов, которые должны быть созданы, использованы или изменены, чтобы модель оружия экспортировалась корректно, и корректная работала в игре. В этом руководстве я опишу необходимые шаги создания всех файлов и папок необходимых для основного экспорта оружия. «Основной экспорт» означает отсутствие модулей или различных режимов.Руководство проследует за моей подготовкой нового дробовика для игры. Это будет включать в себя создание объекта от третьего лица для идентификации оружия в игре. В итоге у меня будет целый ряд файлов, созданных, измененных или используемых, и будет состоять из:
\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

Эту папку, я создам для файла нового дробовика (spas12), который был передан мне моделером оружия. Этот файл является готовой моделью с текстурами сделанными для неё.

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

В этой папке, находятся все мои текстуры для оружия.

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

В этой папке, находится файл «spas12.xml», чтобы использовать его в игре.

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

Этот файл должен быть добавлен и изменён для правильного экспорта анимаций.

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

Этот файл будет использоваться для правильного экспорта нового оружия от первого лица.

Прежде чем я начну

  • Прежде чем я начну экспортировать модели и анимацию от первого и третьего лица, я создам или изменю все файлы, которых я не буду касаться в руководстве, чтобы не пришлось беспокоиться о них потом. Это будет включать в себя изменение файла Animations.cba, а также создание файла «spas12.xml».
  • Если у меня нет файла Animations.cba в моей папке Animation, я могу взять оригинал из файла Animation.pak и разместить его в свою папку Animation. «Определение анимации» для файла spas12_fp.chr, также необходимо для корректного экспорта. Я могу взять необходимый код для него, открыв файл Animations.cba с помощью Блокнота или WordPad'а. Я захвачу от </AnimationDefinition> до </SpecialAnimsList> для дробовика и cкопирую/вставлю его под дробовик, так как они относятся к одному типу (я это сделал по личным причинам, он может быть указан в любом месте без проблем). Вот что я добавил в свой ​​файл Animations.cba для 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>
  • Файл «spas12.xml» у меня является упрощенной версией файла Shotgun.xml, но ограничен нужными мне вещами. В итоге, моё новое оружие «spas12.xml» будет выглядеть так:
 
  <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>
  • Теперь у меня есть файлы, которые нужно было изменить или создать для экспорта и использования spas12 в игре, теперь я могу переходить к экспорту оружия.

Примечание:
Как вы можете видеть в XML-файле, я убрал несколько костей для модулей, все режимы зума, слои, аксессуары, а также вырезал целый ряд анимаций, в которых мне нет надобности. Я также изменил пути анимации до точных CAF-файлов, которые я буду вызывать вместо того, чтобы использовать специальные префиксы, используемые по умолчанию. Также обратите внимание, я уже определил spas12_fp.chr для геометрии от первого лицаи spas12_tp.cgf для геометрии от третьего лица. Наконец, вместо режима огня «default», в параметре «fire» в разделе действий дробовика, определён «fire_cock». Это не имеет никакого влияния в дальнейшем.

Экспорт модели от третьего лица

  • Первое, что я собираюсь сделать после получения полной модели оружия, это настроить мою файловую структуру, сохранив spas12.max в респектабельную папку вместе с текстурами. Далее, я открою файл в 3ds Max, когда я открою модель оружия, я увижу что детали разбросаны, а также нет материала, назначенного на него​.
  • Мне нужно чтобы модель от третьего лица, была затекстурирована и была там же, где и текстуры. Сначала я перемещу все отдельные детали в респектабельные места. Я перейду на вкладку Modify в Command Panel, выберу оружие, выберу Editable poly, и выберу элемент.
  • Как только детали размещены где надо, я войду в Materials Editor нажав клавишу «m». После переименования материала в spas12_tp, я изменю тип материала на Multi/Sub-Object, и задам количество подматериалов равное 1.
  • В подматериала, я сначала изменю шейдер на Crytek Shader, добавлю мою текстуру в разделе Maps как Bitmap, и назначу материал на оружие.
  • После завершения этого, я сохраню свой ​​файл как spas12_tp.max, так как я не буду делать больше изменений. Далее, я создам свой MTL-файл, с помощью утилиты CryEngine 2 Exporter.
  • Прежде, чем я нажму «Create Material», я добавлю новый мультиматериал, щелкнув правой кнопкой мыши в окне иерархии и сохраню его с таким же именем, как у материала для оружия в 3ds Max Material Editor, в данном случае spas12_tp. Как только материал будет добавлен, я снова щелкну правой кнопкой мыши по материалу в SB2 Material Editor и добавлю 1 подматериал. Здесь я выберу свои текстуры для MTL-файла в разделе Texture Maps и закрою окно.
  • После этого я проверю, что моё оружие выбрано для экспорта объектов, я проверю, чтобы он экспортировался в виде файла CGF и проверить правильность имени (spas12_tp). Как только всё будет проверено, я могу с уверенностью экспортировать.
  • Я проверю его в игре, чтобы убедиться, что всё правильно экспортировано для моего оружия от третьего лица. Мы видим, что у меня есть затекстурированный CGF-файл в Character Editor.

Экспорт модели от первого лица

  • Первое, что мне нужно сделать, это убедиться, что у меня есть файл SCAR_L-C_fp.max из мода Example в папке spas12. Как только все будет готово, я начну настройку оружия от первого лица через этот файла
  • Открыв его, я избавлюсь от всего, с чем я не буду иметь дело. Она будет состоять из всего, кроме рук и камеры. Первое, что я сделаю, это выберу всё в сцене и изменю временную шкалу анимации с 1 кадра до 10 000. Это позволит мне, выбрать все ключи в временной шкале и удалить их.
  • Как только это готово, я скрою камеру и выберу всё, что имеет дело с оружием и удалю их, чтобы остались только руки.
  • Следующим шагом, скроем узлы rootL и rootR и уберите оружие из корневого узла, чтобы оно смотрело в положительную ось Y, это даёт правильную ориентацию при экспорте CHR-файла. Для этого я буду использовать «Select by name» на главной панели инструментов и выберу rootL и rootR, нажму кнопку ОК, а затем щелкну правую кнопку мыши и нажму «Hide Selection».
  • Теперь я могу поместить оружие куда нужно. Сначала я выберу корневой узел и выберу инструмент трансформации, используя поля ввода X, Y, Z, изменю оси на отрицательное значение. Затем выберу инструмент вращения и настрою ось Z на 180, чтобы оружие смотрело по положительной оси Y.
  • Сейчас я готов ввести оружие. Я выберу «XRef Object» в меню File, а затем нажму кнопку «Create XRef Record From File», выберу файл spas12.max, выберу spas12 как мой объект и нажму кнопку ОК. Теперь у меня есть мое оружие в сцене.
  • Так как исходный файл уже был правильно отцентрирован и имел корректные пропорции, я ничего не менял у оружия. Я проверю имя объекта (spas12) и переименую его в spas12_fp, поскольку он будет использоваться как оружие от первого лица. Я также преобразую оружие в редактируемую поверхность (Editable Poly).
  • На этот раз я начну настройку дамми-узлов в виде модулей, чтобы я мог связать их с Physique, а потом родителя с каждой частью оружия.

Примечание:
Если вы посмотрите на SCAR_L-C_fp.max, вы заметите, что в основном анимируются кости спускового крючка, защёлки магазина, перезарядки и т.д.. Модули используемые для изменения оружия — прицелы, глушители, фонари — настраиваются с помошью дамми-узлов. В этом уроке я сделаю анимированные части связанными между собой и с дамми-узлами. Это не повлияет на использование в игре, экспорт, или анимирование. На более легкой ноте, анимации от первого лица никогда не срабатывают.

Примечание:
Мне нужно два дамми-узла на часть, я буду использовать в виде «модулей», потому, что узел «top/front» будет ссылаться на верхний вертекс объекта, а «base/back» сообщает, где находится деталь и позволяет пользователю трансформировать/вращать деталь, не влияя на реальную геометрии и, не создавая растяжение. Как только созданы все дамми-узлы, я их переименую на что-нибудь более подходящее.

Дамми-узел сверху оружия нужно назвать «weapon_term», так как это «Bone Attachment», на него в XML-файле назначены эффекты выстрела.

На снимке вы увидите, что деталь для перезарядки дробовика и деталь выброса гильз являются одним модулем. Это сделано специально, поскольку оба анимируются в совокупности, так что эти две детали станут одним модулем.

  • Следующим шагом будет соединение дамми-узлов, так что, при применение модификатора Physique будет создана правильная иерархия. Сначала я выбираю своё оружие и замораживаю его, чтобы не задеть в процесс связывания.

Примечание:
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.
  • 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.
  • 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.

Примечание:
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.

  • 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.
  • 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)