UVAnimations – Arma 3
Jump to navigation
Jump to search
m (→Configuration: Variables fix) |
Lou Montana (talk | contribs) (Add category) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{TOC|side}}{{GVI|arma3|1.84}} | ||
UV animations, in contrast to regular animations, are not part of model.cfg but main vehicle configuration. | UV animations, in contrast to regular animations, are not part of model.cfg but main vehicle configuration. | ||
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]] | * [[animate]] & [[animationPhase]] are not supported by this tech - use [[animateSource]] & [[animationSourcePhase]] instead | ||
* it | * it is using sections instead of bones | ||
* 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 | ||
Line 22: | Line 21: | ||
class UVAnimations | class UVAnimations | ||
{ | { | ||
// You can name it whatever you like since it | // You can name it whatever you like since it is not working with animationPhase or animate command | ||
class TestAnimation_01 | class TestAnimation_01 | ||
{ | { | ||
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 | ||
Line 34: | Line 32: | ||
minValue = 0; | minValue = 0; | ||
maxValue = 1; | maxValue = 1; | ||
// Transformation of UV coordinates | // Transformation of UV coordinates | ||
offset0[] = { 0, 0 }; | |||
offset1[] = { 0, 1 }; | |||
}; | }; | ||
// Example animation using gmeter sources | // Example animation using gmeter sources | ||
class TestAnimation_02 | class TestAnimation_02 | ||
Line 48: | Line 46: | ||
minValue = 0; | minValue = 0; | ||
maxValue = 1; | maxValue = 1; | ||
offset0[] = { 0, 0 }; | |||
offset1[] = { 1, 0 }; | |||
}; | }; | ||
// Example rotation animation | // Example rotation animation | ||
class TestAnimation_03 | class TestAnimation_03 | ||
Line 60: | Line 58: | ||
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 | ||
Line 66: | Line 64: | ||
angle1 = rad 30; // rotate by 30 degrees | angle1 = rad 30; // rotate by 30 degrees | ||
}; | }; | ||
// Example scale | // Example scale | ||
class TestAnimation_04 | class TestAnimation_04 | ||
Line 74: | Line 73: | ||
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 AnimationSources | ||
{ | { | ||
Line 89: | Line 89: | ||
animPeriod = 0.3; | animPeriod = 0.3; | ||
}; | }; | ||
class Test_Source2: Test_Source {}; | |||
class Test_Source2 : Test_Source { }; | |||
}; | }; | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Example == | == Example == | ||
In the following example you can see how the Kart's chain animation was done. | 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 | UV animation is synced with right rear wheel via animation sources creation tech which was introduced with [[Arma 3 Jets]]' PhysX suspension. | ||
It is possible to get damper values too this way. | It is possible to get damper values too this way. | ||
Line 106: | Line 108: | ||
class CfgVehicles | class CfgVehicles | ||
{ | { | ||
class Kart_01_Base_F: Car_F | class Kart_01_Base_F : Car_F | ||
{ | { | ||
class AnimationSources: AnimationSources | class AnimationSources : AnimationSources | ||
{ | { | ||
class Wheel_2_2_source {source = wheel; wheel = RR;}; | class Wheel_2_2_source | ||
{ | |||
source = wheel; | |||
wheel = RR; | |||
}; | |||
}; | }; | ||
class UVAnimations | class UVAnimations | ||
{ | { | ||
Line 122: | Line 129: | ||
minValue = 0; | minValue = 0; | ||
maxValue = 1; | maxValue = 1; | ||
offset0[] = {0,0}; | offset0[] = { 0, 0 }; | ||
offset1[] = {-1,0}; | offset1[] = { -1, 0 }; | ||
}; | }; | ||
}; | }; | ||
Line 130: | Line 137: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Model | === Model Config === | ||
Note the "chain" section! | Note the "chain" section! | ||
Line 137: | Line 144: | ||
{ | { | ||
class Vehicle; | class Vehicle; | ||
class Car:Vehicle | class Car : Vehicle | ||
{ | { | ||
class Animations{}; | class Animations{ }; | ||
}; | }; | ||
Line 146: | Line 153: | ||
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" // here | "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 | ||
{ | { | ||
Line 181: | Line 194: | ||
{{GameCategory|arma3|Editing}} | {{GameCategory|arma3|Editing}} | ||
[[Category:Introduced with Arma 3 version 1.84]] |
Latest revision as of 20:44, 29 May 2023
UV animations, in contrast to regular animations, are not part of model.cfg but main vehicle configuration.
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 are not supported by this tech - use animateSource & animationSourcePhase instead
- it is 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
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 is not working with animationPhase or animate command
class TestAnimation_01
{
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 Arma 3 Jets' 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