UVAnimations – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (→‎Configuration: Variables fix)
(Undo revision 155908 by POLPOX (talk) I think something's off on my end. I'll try again so revert this for now, or forever)
Tag: Undo
Line 34: Line 34:
minValue = 0;
minValue = 0;
maxValue = 1;
maxValue = 1;
center[] = {0.5,0.5};
// Transformation of UV coordinates
// Transformation of UV coordinates
scale0[] = {0,0};
offset0[] = {0,0};
scale1[] = {0,1};
offset1[] = {0,1};
};
};
// Example animation using gmeter sources
// Example animation using gmeter sources
Line 48: Line 47:
minValue = 0;
minValue = 0;
maxValue = 1;
maxValue = 1;
center[] = {0.5,0.5};
offset0[] = {0,0};
scale0[] = {0,0};
offset1[] = {1,0};
scale1[] = {1,0};
};
};
// Example rotation animation
// Example rotation animation
Line 94: Line 92:
};
};
</syntaxhighlight>
</syntaxhighlight>


== Example ==
== Example ==

Revision as of 17:29, 31 July 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