Howto Model Config – ArmA: Armed Assault

From Bohemia Interactive Community
Revision as of 10:57, 6 December 2023 by Lou Montana (talk | contribs) (Text replacement - " ( *class [a-zA-Z0-9_]+): *([a-zA-Z0-9_]+ *) " to " $1 : $2 ")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

General

The model.cfg contains description about the skeleton and the functionality (animations) of a model. The model.cfg is divided in two classes, which are class CfgSkeletons and class CfgModels .

In class CfgSkeletons all animated "bones" of the model are defined (in this example for an AH-64). Bones which have to be animated together, as it should be in turrets with guns, are linked here. The skeleton can have a hierarchy (as here with the AH-64), which means that each bone is affixed on the previous one. If it does not have a hierarchy, all bones are on the same level.

In class CfgModels you can define sections of a model which can be required for certain effects (like rotor blur) or for hiddenselections (as in OFP days with setObjectTexture). Also, you have to define the animations in the CfgModels nowadays.


CfgSkeletons example

class CfgSkeletons
{

	class Default
	{

		isDiscrete = 1;
		skeletonInherit = "";
		skeletonBones[] = {};

	};

	class Vehicle : Default{};

	class Helicopter : Vehicle
	{

		skeletonInherit="Vehicle"; // loads the bones of class Vehicle
		skeletonBones[]=
		{

			"velka vrtule","", // main rotor
			"mala vrtule","", // tail rotor
			...
			...

		};

	};

	class AH64_Skeleton : Helicopter
	{

		skeletonInherit="Helicopter"; // loads the bones of class Helicopter
		skeletonBones[]=
		{

			"mainRotor","", // main rotor
			"tailRotor","", //tail rotor

			"FGear","", // front gear
			"RGear","", // rear gear

			"map_tail","", // tail fin

			"sensors_turret","", // sensor turret
			"sensors","sensors_turret", // sensor head with mit sensor turret

		};

	};

};


CfgSkeletons explanations

isDiscrete = 0;

Defines if the bones have a hierarchy or not (0 = no hierarchy, for characters).

skeletonInherit = "";

Defines which skeleton class is inherited, for example skeletonInherit = "Helicopter"; loads the bones of class Helicopter.

skeletonBones[] = {...an Arraylist of bones...};

Defines the bones.

Ordinarily, any bones declared in parent(s) would be ignored by a new array declaration. skeletonInherit is a sneaky way of retaining the existing list (if any). Ordinarily, skeletonInherit simply points to the parent of this class (if any).

CfgModels example

class CfgModels
{

	class Default
	{

		sectionsInherit="";
		sections[] = {};
		skeletonName = "";

	};

	class Vehicle : Default
	{

		sections[] =
		{

			"clan",
			"clan_sign",
			...
			...
			"zasleh"

		};

	};

	class Helicopter : Vehicle
	{

		sectionsInherit="Vehicle";
		sections[]=
		{

			"velka vrtule staticka",
			"velka vrtule blur",
			"mala vrtule staticka",
			"mala vrtule blur",
			...
			...

		};
		skeletonName="Helicopter";
		class Animations
		{

			class IndicatorAltRadar : Rotation
			{

				source="altRadar";
				sourceAddress="loop";
				selection="alt";
				axis="osa_alt";
				memory=0;
				maxValue=304;
				angle1="rad -360";

			};
			class IndicatorAltRadar2 : IndicatorAltRadar
			{

				selection="alt2";
				axis="osa_alt2";

			};

			...
			...

		};

	};

	class ah64 : Helicopter
	{

		sectionsInherit = "Helicopter";
		sections[] =
		{

			"mainRotor","mainRotor_staticka","mainRotor_blur","mainRotor_dive",
			"tailRotor","tailRotor_staticka","tailRotor_blur",

			"tail_fin"

		};
		skeletonName = "AH64_Skeleton";
		class Animations : Animations
		{

			class mainRotor
			{

				type = "rotationY";
				source = "rotorH";
				selection = "mainRotor";
				axis = "";
				memory = 1;
				sourceAddress = "loop";
				minValue = 0;
				maxValue = 1;
				angle0 = 0;
				angle1 = "rad +360";

			};
			class mainRotor_dive
			{

				type = "rotationX";
				source = "rotorHdive";
				selection = "mainRotor";
				axis = "predni osa naklonu";
				memory = 1;
				minValue = -1.570800;
				maxValue = 1.570800;
				angle0 = -1.570796;
				angle1 = 1.570796;

			};
			class tailRotor
			{

				type = "rotationX";
				source = "rotorV";
				selection = "tailRotor";
				axis = "";
				memory = 1;
				sourceAddress = "loop";
				minValue = 0;
				maxValue = 1;
				angle0 = 0;
				angle1 = "rad -360";

			};
			class mainTurret
			{

				type = "rotationY";
				source = "mainTurret";
				selection = "otocvez";
				axis = "osaveze";
				animPeriod = 0;
				memory = 1;
				minValue = "rad -360";
				maxValue = "rad +360";
				angle0 = "rad -360";
				angle1 = "rad +360";

			};
			class mainGun
			{

				type = "rotationX";
				source = "mainGun";
				selection = "otochlaven";
				axis = "osahlavne";
				animPeriod = 0;
				memory = 1;
				minValue = "rad -360";
				maxValue = "rad +360";
				angle0 = "rad -360";
				angle1 = "rad +360";

			};
			class sensors_turret : mainTurret
			{

				selection = "sensors_turret";
				axis = "axis_sensors_turret";

			};
			class sensors : mainGun
			{

				selection = "sensors";
				axis = "axis_sensors";

			};

			...

			...

		};

	};

};


CfgModels explanations

sectionsInherit = "";

Defines which sections are inherited, for example sectionsInherit = "Helicopter"; loads all sections of class Helicopter.

sections[] = {};

Defines the sections.

Again, like skeletonInherit, sectionsInherit prevents the erasure of existing sections inherited from parents. Generally (unlike skeletonInherit), sectionsInherit tends to point to a base class. In this example, one and the same thing, but it is quite comment for a range of specific helicopter models to be itemised in a single model.cfg, each progressively inheriting from each other, but the sectionsInherit points to the one and only base class.

Note to the unwary, that sectionsInherit must be declared in *every* class model that introduces added bones to that class. Sounds logical. It is frequently overlooked.

skeletonName = "";

Defines which skeleton (defined by CfgSkeleton) is used by this model. It is common eg. to #include a common skeleton 'library'. Helicopters, tanks. pink elephants. Only the wanted skeleton is massaged into the p3d. Other skeletons are ignored and cause no harm.

class Animations{...};

Defines the animations for the model. It can be inherited from another model via class Animations : Animations{...};

For explanations for the class Animations, see page Model_Config.