Howto Model Config – ArmA: Armed Assault

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - " ( *class [a-zA-Z0-9_]+): *([a-zA-Z0-9_]+ *) " to " $1 : $2 ")
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{TOC|side}}
=== General ===
=== General ===


Line 4: Line 5:
class CfgSkeletons and class CfgModels .
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 (as used on character models).
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.
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.
Line 11: Line 12:
=== CfgSkeletons example ===
=== CfgSkeletons example ===


<pre>
<syntaxhighlight lang="cpp">
class CfgSkeletons
class CfgSkeletons
{
{


    class Default
class Default
    {
{


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


    };
};


    class Vehicle : Default{};
class Vehicle : Default{};


    class Helicopter : Vehicle
class Helicopter : Vehicle
    {
{


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


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


        };
};


    };
};


    class AH64_Skeleton : Helicopter
class AH64_Skeleton : Helicopter
    {
{


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


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


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


            "map_tail","", // tail fin
"map_tail","", // tail fin


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


        };
};


    };
};


};
};
</pre>
</syntaxhighlight>




=== CfgSkeletons explanations ===
=== CfgSkeletons explanations ===


isDiscrete = 0;
isDiscrete = 0;


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


skeletonInherit = "";
skeletonInherit = "";


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


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


Defines the 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 ===
=== CfgModels example ===


<pre>
<syntaxhighlight lang="cpp">
class CfgModels
class CfgModels
{
{


    class Default
class Default
    {
{


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


    };
};


    class Vehicle : Default
class Vehicle : Default
    {
{


        sections[] =
sections[] =
        {
{


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


        };
};


    };
};


    class Helicopter : Vehicle
class Helicopter : Vehicle
    {
{


        sectionsInherit="Vehicle";
sectionsInherit="Vehicle";
        sections[]=
sections[]=
        {
{


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


        };
};
        skeletonName="Helicopter";
skeletonName="Helicopter";
        class Animations
class Animations
        {
{


            class IndicatorAltRadar: Rotation
class IndicatorAltRadar : Rotation
            {
{


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


            };
};
            class IndicatorAltRadar2: IndicatorAltRadar
class IndicatorAltRadar2 : IndicatorAltRadar
            {
{


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


            };
};


            ...
...
            ...
...


        };
};


    };
};


    class ah64 : Helicopter
class ah64 : Helicopter
    {
{


        sectionsInherit = "Helicopter";
sectionsInherit = "Helicopter";
        sections[] =
sections[] =
        {
{


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


            "tail_fin"
"tail_fin"


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


            class mainRotor
class mainRotor
            {
{


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


            };
};
            class mainRotor_dive
class mainRotor_dive
            {
{


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


            };
};
            class tailRotor
class tailRotor
            {
{


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


            };
};
            class mainTurret
class mainTurret
            {
{


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


            };
};
            class mainGun
class mainGun
            {
{


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


            };
};
            class sensors_turret : mainTurret
class sensors_turret : mainTurret
            {
{


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


            };
};
            class sensors : mainGun
class sensors : mainGun
            {
{


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


            };
};


            ...
...


            ...
...


        };
};


    };
};


};
};
</pre>
</syntaxhighlight>




=== CfgModels explanations ===
=== CfgModels explanations ===


sectionsInherit="";
sectionsInherit = "";


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


sections[] = {};
sections[] = {};


Defines the sections.
Defines the sections.


skeletonName = "";
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.


Defines which skeleton (defined by CfgSkeleton) is used by this model.
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.


class Animations{...};
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{...};
Defines the animations for the model. It can be inherited from another model via class Animations : Animations{...};
Line 299: Line 305:




[[Category:ArmA: Editing]]
{{GameCategory|arma1|Reference Lists}}
[[Category: ArmA Classes]]

Latest revision as of 10:57, 6 December 2023

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.