Arma 3 Scripting

animateSource

  • Global argument
  • Global effect
  • Arma 3 v1.58

Command · Markdown · JSON · original wiki page

Description

Process an animation of the object. If animate uses class name from CfgModels Animations, animateSource uses name defined by the source property. AnimationSources can animate multiple animate Animations. AnimationSource is defined in CfgVehicles' AnimationSources (see Arma 3: createVehicle/vehicles).

Note

Arma 3: It is recommended that animateSource command is used instead of animate whenever is possible, as it is more efficient and optimized for MP

Warning

Mixing animateSource command with animate command to animate the same part may produce some undefined behaviour.

Syntax

object animateSource [source, phase, speed]

Parameters:

Returns: Nothing

Examples

Example 1

house animateSource ["Door_1_source", 1, true];

Example 2

Create UGV and manipulate its turret (Not possible to do with animate command. See Arma 3: 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:

// Bar Gate init
if (isServer) then
{
    private _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]"
    ];
};

See also

animationSourcePhase · setFaceAnimation · animate · animationPhase · animateDoor · doorPhase · animationNames