UVAnimations – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (R3vo moved page UVAnimations to Arma 3 UVAnimations: added TAG)
m (Some wiki formatting)
Line 1: Line 1:
[[Category:Arma 3: Editing]]
{{SideTOC}}
{{Cfg ref|abc}}
UV animations, in contrast to regular animations, are not part of model.cfg but main vehicle configuration.
 
Technology was introduced in {{GVI|arma3|1.84}}.
 
==Overview==


UV animations, in contrast to regular animations, are not part of model.cfg but main vehicle configuration. Technology was introduced in {{GVI|arma3|1.84}}.
Their usage is pretty similar to typical animation created in model.cfg (see [[Model Config]]) but there are few differences:
 
 
Their usage is pretty similar to typical animation created in model.cfg (see [[Model Config]] ) but there are few differences:
* translation, rotation & scale is supported
* translation, rotation & scale is supported
* [[animate]] & [[animationPhase]] is not supported by this tech - use [[animateSource]] & [[animationSourcePhase]] instead
* [[animate]] & [[animationPhase]] is not supported by this tech - use [[animateSource]] & [[animationSourcePhase]] instead
Line 14: Line 9:
* UV animations can be stacked - animating same section by multiple animations will result in multiplication of matrices
* UV animations can be stacked - animating same section by multiple animations will result in multiplication of matrices
* order of UV animation matters in case single section is animated by multiple animations
* order of UV animation matters in case single section is animated by multiple animations
* needs RVMAT assigned (any type) - should be fixed in 1.84
* needs RVMAT assigned (any type) - fixed in 1.84.


=Configuration=
 
<syntaxhighlight lang="c">
== Configuration ==
class cfgVehicles
 
<syntaxhighlight lang="cpp">
class CfgVehicles
{
{
    class TestVehicle
class TestVehicle
    {
{
        // UV animations are defined in vehicle config & they are not baked to p3d in contrast to regular animations  
// UV animations are defined in vehicle config & they are not baked to p3d in contrast to regular animations
        class UVAnimations
class UVAnimations
        {
{
            // You can name it whatever you like since it's not working with animationPhase or animate command
// You can name it whatever you like since it's not working with animationPhase or animate command
            class TestAnimation_01
class TestAnimation_01
            {
{
// For now, it's only supported type of animation
// For now, it's only supported type of animation
                type           = translation;
type = translation;
                // name of source, either custom one, defined in AnimationSources class or regular model.cfg source
// name of source, either custom one, defined in AnimationSources class or regular model.cfg source
                // It can be animated with animateSource & value can be retrieved via animationSourcePhase
// It can be animated with animateSource & value can be retrieved via animationSourcePhase
                source           = Test_Source;
source = Test_Source;
                // section name from model.cfg sections[] array
// section name from model.cfg sections[] array
                section           = camo1;
section = camo1;
                minValue       = 0;
minValue = 0;
                maxValue       = 1;
maxValue = 1;
                // Transformation of UV coordinates
// Transformation of UV coordinates
                offset0[]       = {0,0};
offset0[] = {0,0};
                offset1[]       = {0,1};
offset1[] = {0,1};
            };
};
            // Example animation using gmeter sources
// Example animation using gmeter sources
            class TestAnimation_02
class TestAnimation_02
            {
{
                type             = translation;
type = translation;
                source           = gmeter;
source = gmeter;
                sourceAddress   = loop;
sourceAddress = loop;
                section         = camo2;
section = camo2;
                minValue         = 0;
minValue = 0;
                maxValue         = 1;
maxValue = 1;
                offset0[]       = {0,0};
offset0[] = {0,0};
                offset1[]       = {1,0};
offset1[] = {1,0};
            };
};
// Example rotation animation
// Example rotation animation
            class TestAnimation_03
class TestAnimation_03
            {
{
                type           = rotate;
type = rotate;
                source         = Test_Source;
source = Test_Source;
                section         = camo2;
section = camo2;
                minValue       = 0;
minValue = 0;
                maxValue       = 1;
maxValue = 1;
// [x,y] - coordinates defining center of rotation
// [x,y] - coordinates defining center of rotation
              center[] = { 0.5, 0.5 };
center[] = { 0.5, 0.5 };
// angles are in radians just like in model.cfg
// angles are in radians just like in model.cfg
angle0 = 0;
angle0 = 0;
angle1 = rad 30; // rotate by 30 degrees  
angle1 = rad 30; // rotate by 30 degrees
};
};
// Example scale
// Example scale
            class TestAnimation_04
class TestAnimation_04
            {
{
                type           = scale;
type = scale;
                source         = Test_Source2;
source = Test_Source2;
                section         = camo2;
section = camo2;
                minValue       = 0;
minValue = 0;
                maxValue       = 1;
maxValue = 1;
// [x,y] - coordinates defining center of rotation
// [x,y] - coordinates defining center of rotation
              center[] = { 0.5, 0.5 };
center[] = { 0.5, 0.5 };
// 1 means that there will be no change to the UV
// 1 means that there will be no change to the UV
scale0[] = {1,1};
scale0[] = {1,1};
scale1[] = {2,2}; // make UV map twice as large
scale1[] = {2,2}; // make UV map twice as large
};
};
class AnimationSources
{
class Test_Source
{
source = user;
initPhase = 1;
animPeriod = 0.3;
};
};
        };
        class AnimationSources
        {
            class Test_Source
            {
                source        = user;
                initPhase    = 1;
                animPeriod    = 0.3;
            };           
class Test_Source2: Test_Source {};
class Test_Source2: Test_Source {};
    };
};
};
};
};
</syntaxhighlight>
</syntaxhighlight>


=Example=
In following example you can see how chain animation Kart was done. UV animation is synced with right rear wheel via animation sources creation tech which was introduced with Jets DLC PhysX suspension. It's possible to get damper values too this way.


==config.cpp==
== Example ==
<syntaxhighlight lang="c">
 
In the following example you can see how the Kart's chain animation was done.
UV animation is synced with right rear wheel via animation sources creation tech which was introduced with Jets DLC PhysX suspension.
It is possible to get damper values too this way.
 
=== config.cpp ===
 
<syntaxhighlight lang="cpp">
class CfgVehicles
class CfgVehicles
{
{
Line 126: Line 129:
</syntaxhighlight>
</syntaxhighlight>


==Model config==
=== Model config ===
Note "chain" section!
 
<syntaxhighlight lang="c">
Note the "chain" section!
<syntaxhighlight lang="cpp">
class CfgModels
class CfgModels
{
{
Line 141: Line 145:
sections[] =
sections[] =
{
{
"camo","camo2","zbytek","Number_a","Number_b","wheel_1_1_hide","wheel_1_2_hide","wheel_2_1_hide","wheel_2_2_hide","chain"
"camo","camo2","zbytek","Number_a","Number_b","wheel_1_1_hide","wheel_1_2_hide","wheel_2_1_hide","wheel_2_2_hide","chain" // here
};
};
class Animations : Animations
class Animations : Animations
{
{
// Example of custom animation source utilizing
// Example of custom animation source using it
class wheel_shaft_2
class wheel_shaft_2
{
{
type = rotation;
type = rotation;
source = wheel_2_2_source;
source = wheel_2_2_source;
sourceAddress = loop;
sourceAddress = loop;
selection = wheel_shaft_2;
selection = wheel_shaft_2;
axis = wheel_shaft_2_axis;
axis = wheel_shaft_2_axis;
minValue = 0;
minValue = 0;
maxValue = 1;
maxValue = 1;
angle0 = (rad -0);
angle0 = (rad -0);
angle1 = (rad +360);
angle1 = (rad +360);
};
};
};
};
Line 162: Line 166:
};
};
</syntaxhighlight>
</syntaxhighlight>
=Scripting=
Related commands
[[animateSource]]
[[animationSourcePhase]]




= Related =
== Scripting ==
 
* [[animateSource]]
* [[animationSourcePhase]]
 
 
== See Also ==
 
* [[Model Config]]
* [[Model Config]]
[[Category:Arma 3: Editing]]

Revision as of 13:47, 1 June 2020

Template:SideTOC UV animations, in contrast to regular animations, are not part of model.cfg but main vehicle configuration. Technology was introduced in Arma 3 logo black.png1.84.

Their usage is pretty similar to typical animation created in model.cfg (see Model Config) but there are few differences:

  • translation, rotation & scale is supported
  • animate & animationPhase is not supported by this tech - use animateSource & animationSourcePhase instead
  • it's using sections instead of bones
  • UV animations can be stacked - animating same section by multiple animations will result in multiplication of matrices
  • order of UV animation matters in case single section is animated by multiple animations
  • needs RVMAT assigned (any type) - fixed in 1.84.


Configuration

class CfgVehicles
{
	class TestVehicle
	{
		// UV animations are defined in vehicle config & they are not baked to p3d in contrast to regular animations
		class UVAnimations
		{
			// You can name it whatever you like since it's not working with animationPhase or animate command
			class TestAnimation_01
			{
				// For now, it's only supported type of animation
				type			= translation;
				// name of source, either custom one, defined in AnimationSources class or regular model.cfg source
				// It can be animated with animateSource & value can be retrieved via animationSourcePhase
				source			= Test_Source;
				// section name from model.cfg sections[] array
				section			= camo1;
				minValue		= 0;
				maxValue		= 1;
				// Transformation of UV coordinates
				offset0[]		= {0,0};
				offset1[]		= {0,1};
			};
			// Example animation using gmeter sources
			class TestAnimation_02
			{
				type			= translation;
				source			= gmeter;
				sourceAddress	= loop;
				section			= camo2;
				minValue		= 0;
				maxValue		= 1;
				offset0[]		= {0,0};
				offset1[]		= {1,0};
			};
			// Example rotation animation
			class TestAnimation_03
			{
				type			= rotate;
				source			= Test_Source;
				section			= camo2;
				minValue		= 0;
				maxValue		= 1;
				// [x,y] - coordinates defining center of rotation
				center[]		= { 0.5, 0.5 };
				// angles are in radians just like in model.cfg
				angle0			= 0;
				angle1			= rad 30; // rotate by 30 degrees
			};
			// Example scale
			class TestAnimation_04
			{
				type			= scale;
				source			= Test_Source2;
				section			= camo2;
				minValue		= 0;
				maxValue		= 1;
				// [x,y] - coordinates defining center of rotation
				center[]		= { 0.5, 0.5 };
				// 1 means that there will be no change to the UV
				scale0[]		= {1,1};
				scale1[]		= {2,2}; // make UV map twice as large
			};
		};
		class AnimationSources
		{
			class Test_Source
			{
				source			= user;
				initPhase		= 1;
				animPeriod		= 0.3;
			};
			class Test_Source2: Test_Source {};
		};
	};
};


Example

In the following example you can see how the Kart's chain animation was done. UV animation is synced with right rear wheel via animation sources creation tech which was introduced with Jets DLC PhysX suspension. It is possible to get damper values too this way.

config.cpp

class CfgVehicles
{
	class Kart_01_Base_F: Car_F
	{
		class AnimationSources: AnimationSources
		{
			class Wheel_2_2_source	{source = wheel; wheel = RR;};
		};
		class UVAnimations
		{
			class Chain
			{
				type			= translation;
				source			= Wheel_2_2_source;
				sourceAddress	= loop;
				section			= Chain;
				minValue		= 0;
				maxValue		= 1;
				offset0[]		= {0,0};
				offset1[]		= {-1,0};
			};
		};
	};
};

Model config

Note the "chain" section!

class CfgModels
{
	class Vehicle;
	class Car:Vehicle
	{
		class Animations{};
	};

	class Kart_01_F : Car
	{
		sections[] =
		{
			"camo","camo2","zbytek","Number_a","Number_b","wheel_1_1_hide","wheel_1_2_hide","wheel_2_1_hide","wheel_2_2_hide","chain" // here
		};
		class Animations : Animations
		{
			// Example of custom animation source using it
			class wheel_shaft_2
			{
				type			= rotation;
				source			= wheel_2_2_source;
				sourceAddress	= loop;
				selection		= wheel_shaft_2;
				axis			= wheel_shaft_2_axis;
				minValue		= 0;
				maxValue		= 1;
				angle0			= (rad -0);
				angle1			= (rad +360);
			};
		};
	};
};


Scripting


See Also