animateSource: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("serv...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma3 | | arma3 | ||
|1.58 | |1.58 | ||
|eff= global|Multiplayer Effects= | |eff= global|Multiplayer Effects= | ||
|arg= global|Multiplayer Arguments= | |arg= global|Multiplayer Arguments= | ||
|gr1= Animations | |gr1= Animations | ||
| Process an animation of the object. If [[animate]] uses class name from [[CfgModels]] ''Animations'', [[animateSource]] uses name defined by ''source'' property. This allows to use just one command on a bunch of animations related to the same source simultaneously. Since Arma 3 v1.65.138459 speed of animation can be altered with coefficient. | | Process an animation of the object. If [[animate]] uses class name from [[CfgModels]] ''Animations'', [[animateSource]] uses name defined by ''source'' property. This allows to use just one command on a bunch of animations related to the same source simultaneously. Since Arma 3 v1.65.138459 speed of animation can be altered with coefficient. | ||
Line 72: | Line 72: | ||
{{Warning | Mixing [[animateSource]] command with [[animate]] command to animate the same part can lead to unexpected behavior}} | {{Warning | Mixing [[animateSource]] command with [[animate]] command to animate the same part can lead to unexpected behavior}} | ||
| | | object '''animateSource''' [source, phase, speed] | ||
| | |p1= object: [[Object]] | ||
| | |p2= [source, phase, speed]: [[Array]] | ||
| | |p3= source: [[String]] - common source | ||
| | |p4= phase: [[Number]] - wanted animation phase | ||
| [[ | |p5= speed: [[Boolean]] or [[Number]] - When [[true]] animation is instant. Since Arma 3 v1.65.138459 [[Number]] > 0 is treated as config speed value multiplier | ||
| [[Nothing]] | |||
|x1= <code>house [[animateSource]] ["Door_1_source", 1, [[true]]];</code> | |||
|x1= <code>house [[animateSource]] ["Door_1_source", 1, [[true]]];</code> | |||
|x2= Create UGV and manipulate its turret (Currently not possible to do with [[animate]] command. See [[createVehicle/vehicles]] for reference)<code>ugv = "B_UGV_01_F" [[createVehicle]] ([[player]] [[getRelPos]] [5, 0]); | |x2= Create UGV and manipulate its turret (Currently not possible to do with [[animate]] command. See [[createVehicle/vehicles]] for reference)<code>ugv = "B_UGV_01_F" [[createVehicle]] ([[player]] [[getRelPos]] [5, 0]); | ||
Line 102: | Line 102: | ||
ugv [[addAction]] ["Turret Right", {ugv [[animateSource]] ["MainTurret", -[[rad]] 90]}]; | ugv [[addAction]] ["Turret Right", {ugv [[animateSource]] ["MainTurret", -[[rad]] 90]}]; | ||
ugv [[addAction]] ["Turret Up", {ugv [[animateSource]] ["MainGun", [[rad]] 30]}]; | ugv [[addAction]] ["Turret Up", {ugv [[animateSource]] ["MainGun", [[rad]] 30]}]; | ||
ugv [[addAction]] ["Turret Down", {ugv [[animateSource]] ["MainGun", -[[rad]] 20]}];</code> | ugv [[addAction]] ["Turret Down", {ugv [[animateSource]] ["MainGun", -[[rad]] 20]}];</code> | ||
|x3= <code>barGate [[animateSource]] ["Door_1_sound_source", 1]; //Open | |x3= <code>barGate [[animateSource]] ["Door_1_sound_source", 1]; //Open | ||
barGate [[animateSource]] ["Door_1_sound_source", 0]; //Close</code> | barGate [[animateSource]] ["Door_1_sound_source", 0]; //Close</code> | ||
|x4= Open/close Bar Gate automatically: <code>//--- init of the Bar Gate | |x4= Open/close Bar Gate automatically: <code>//--- init of the Bar Gate | ||
Line 122: | Line 122: | ||
};</code>|= EXAMPL4 | };</code>|= EXAMPL4 | ||
| [[animationSourcePhase]], [[setFaceAnimation]], [[animate]], [[animationPhase]], [[animateDoor]], [[doorPhase]], [[animationNames]] | | [[animationSourcePhase]], [[setFaceAnimation]], [[animate]], [[animationPhase]], [[animateDoor]], [[doorPhase]], [[animationNames]] | ||
| |MPBEHAVIOUR= | | |MPBEHAVIOUR= |
Revision as of 00:00, 18 January 2021
Description
- Description:
- Process an animation of the object. If animate uses class name from CfgModels Animations, animateSource uses name defined by source property. This allows to use just one command on a bunch of animations related to the same source simultaneously. Since Arma 3 v1.65.138459 speed of animation can be altered with coefficient.
A class with the same source name should also be present in main config in CfgVehicles AnimationSources and have to be bound to the "user" controller for the command to work. If in order to animate door in example below using animate command it would require 2 calls:
house animate ["Door_1_rot", 1];
house animate ["Door_Handle_1_rot", 1];
With animateSource this would require only 1 (provided everything is configured correctly):
house animateSource ["Door_1_sound_source", 1];
// model.cfg .... class Animations { class Door_1_rot { type = rotation; source = Door_1_sound_source; selection = Door_1; axis = Door_1_axis; memory = 1; minValue = 0.1; maxValue = 1; angle0 = 0; angle1 = (rad 110); }; class Door_Handle_1_rot { type = rotation; source = Door_1_noSound_source; selection = Door_Handle_1; axis = Door_Handle_1_axis; memory = 1; minValue = 0; maxValue = 0.1; angle0 = 0; angle1 = (rad -50); }; }; ... // config.cpp ... class AnimationSources { class Door_1_sound_source { source = "user"; initPhase = 0; animPeriod = 1; sound = "GenericDoorsSound"; soundPosition = "Door_1_trigger"; }; }; ...
If you don't know much about model config you can use this page createVehicle/vehicles for reference. Some of the AnimationSources are listed with the class names of the available assets in Arma 3. If it says "user", the chances are it could work with animateSource (see example 2).
- Groups:
- Animations
Syntax
- Syntax:
- object animateSource [source, phase, speed]
- Parameters:
- object: Object
- [source, phase, speed]: Array
- source: String - common source
- phase: Number - wanted animation phase
- speed: Boolean or Number - When true animation is instant. Since Arma 3 v1.65.138459 Number > 0 is treated as config speed value multiplier
- Return Value:
- Nothing
Examples
- Example 1:
house animateSource ["Door_1_source", 1, true];
- Example 2:
- Create UGV and manipulate its turret (Currently not possible to do with animate command. See createVehicle/vehicles for reference)
ugv = "B_UGV_01_F" createVehicle (player getRelPos [5, 0]); ugv addAction ["Show Turret", { ugv animateSource ["Turret", 0]; ugv animateSource ["MainTurret", rad 0, true]; ugv animateSource ["MainGun", rad 0, true]; }]; ugv addAction ["Hide Turret", {ugv animateSource ["Turret", 1]}]; ugv addAction ["Turret Left", {ugv animateSource ["MainTurret", rad 90]}]; ugv addAction ["Turret Right", {ugv animateSource ["MainTurret", -rad 90]}]; ugv addAction ["Turret Up", {ugv animateSource ["MainGun", rad 30]}]; ugv addAction ["Turret Down", {ugv animateSource ["MainGun", -rad 20]}];
- Example 3:
barGate animateSource ["Door_1_sound_source", 1]; //Open barGate animateSource ["Door_1_sound_source", 0]; //Close
- Example 4:
- Open/close Bar Gate automatically:
//--- init of the Bar Gate if (isServer) then { _gateTrigger = createTrigger ["EmptyDetector", getPosWorld this, false]; _gateTrigger setVariable ["BarGateObj", this]; _gateTrigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _gateTrigger setTriggerArea [5, 25, getDir this, true]; _gateTrigger setTriggerStatements [ "this", "thisTrigger getVariable ""BarGateObj"" animateSource [""Door_1_sound_source"", 1]", "thisTrigger getVariable ""BarGateObj"" animateSource [""Door_1_sound_source"", 0]" ]; };
Additional Information
- See also:
- animationSourcePhasesetFaceAnimationanimateanimationPhaseanimateDoordoorPhaseanimationNames
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note