animate: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "_{10,} " to "")
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|Comments=
{{Command


| ofpr |Game name=
| ofpr


|1.75|Game version=
|1.75


|arg= global |Multiplayer Arguments=
|arg= global |Multiplayer Arguments=
Line 9: Line 9:
|eff= global |Multiplayer Effects=
|eff= global |Multiplayer Effects=


|gr1= Animations |GROUP1=
|gr1= Animations


| Activates given object animation. Animation is defined in CfgModels [[Model Config#Animations|animations]] class.<br>
| Activates given object animation. Animation is defined in CfgModels [[Model Config#Animations|animations]] class.<br>
Line 18: Line 18:
{{Feature|arma3| It is recommended that [[animateSource]] command is used instead of [[animate]] whenever is possible, as it is more efficient and optimised for MP}}
{{Feature|arma3| It is recommended that [[animateSource]] command is used instead of [[animate]] whenever is possible, as it is more efficient and optimised for MP}}


{{Warning | Mixing [[animateSource]] command with [[animate]] command to animate the same part may produce some undefined behaviour}} |DESCRIPTION=
{{Warning | Mixing [[animateSource]] command with [[animate]] command to animate the same part may produce some undefined behaviour}}


| objectName [[animate]] [animationName, phase, speed] |SYNTAX=
| objectName [[animate]] [animationName, phase, speed]


|p1= objectName: [[Object]] |PARAMETER1=
|p1= objectName: [[Object]]


|p2= [animationName, phase, speed]: [[Array]] |PARAMETER2=
|p2= [animationName, phase, speed]: [[Array]]


|p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config. |PARAMETER3=
|p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config.


|p4= phase: [[Number]] - range 0 (start point of the animation) to 1 (end point of the animation). The speed, in which the animation is processed, is defined in the addon's config.cpp and cannot be changed during running missions. |PARAMETER4=
|p4= phase: [[Number]] - range 0 (start point of the animation) to 1 (end point of the animation). The speed, in which the animation is processed, is defined in the addon's config.cpp and cannot be changed during running missions.


|p5= speed: [[Boolean]] or [[Number]] - When [[true]] animation is instant. Since {{arma3}} v1.65.138459 [[Number]] > 0 is treated as config speed value multiplier |PARAMETER5=
|p5= speed: [[Boolean]] or [[Number]] - When [[true]] animation is instant. Since {{arma3}} v1.65.138459 [[Number]] > 0 is treated as config speed value multiplier


| [[Nothing]] |RETURNVALUE=
| [[Nothing]]


   
   
|x1= <code>_building [[animate]] ["maindoor", 1];</code> |EXAMPLE1=
|x1= <code>_building [[animate]] ["maindoor", 1];</code>


|x2= <code>_building [[animate]] ["Door_1_rot", 1, [[true]]];</code> |EXAMPLE2=
|x2= <code>_building [[animate]] ["Door_1_rot", 1, [[true]]];</code>


|x3= Create Offroad and add flashing police light bar:<code>offroad = "C_Offroad_01_F" [[createVehicle]] ([[player]] [[getRelPos]] [5, 0]);
|x3= Create Offroad and add flashing police light bar:<code>offroad = "C_Offroad_01_F" [[createVehicle]] ([[player]] [[getRelPos]] [5, 0]);
offroad [[animate]] ["HidePolice", 0];
offroad [[animate]] ["HidePolice", 0];
offroad [[animate]] ["BeaconsStart", 1];</code> |EXAMPLE3=
offroad [[animate]] ["BeaconsStart", 1];</code>


| [[animationPhase]], [[setFaceAnimation]], [[animateSource]], [[animationSourcePhase]], [[animateDoor]], [[doorPhase]], [[animationNames]] |SEEALSO=
| [[animationPhase]], [[setFaceAnimation]], [[animateSource]], [[animationSourcePhase]], [[animateDoor]], [[doorPhase]], [[animationNames]]


}}
}}

Revision as of 00:04, 18 January 2021

Hover & click on the images for description

Description

Description:
Activates given object animation. Animation is defined in CfgModels animations class.
Since Arma 3 v1.58 animation names can be obtained with animationNames.

Class names listed in CfgVehicles AnimationSources bound to "Proxy" controller can also be animated with animate command (see createVehicle/vehicles).
Arma 3
It is recommended that animateSource command is used instead of animate whenever is possible, as it is more efficient and optimised for MP
Mixing animateSource command with animate command to animate the same part may produce some undefined behaviour
Groups:
Animations

Syntax

Syntax:
objectName animate [animationName, phase, speed]
Parameters:
objectName: Object
[animationName, phase, speed]: Array
animationName: String - name of the animation. This is the class-name of the animation defined in the config.
phase: Number - range 0 (start point of the animation) to 1 (end point of the animation). The speed, in which the animation is processed, is defined in the addon's config.cpp and cannot be changed during running missions.
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:
_building animate ["maindoor", 1];
Example 2:
_building animate ["Door_1_rot", 1, true];
Example 3:
Create Offroad and add flashing police light bar:offroad = "C_Offroad_01_F" createVehicle (player getRelPos [5, 0]); offroad animate ["HidePolice", 0]; offroad animate ["BeaconsStart", 1];

Additional Information

See also:
animationPhasesetFaceAnimationanimateSourceanimationSourcePhaseanimateDoordoorPhaseanimationNames

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

Notes

Posted on Aug 2007
Mikero
Animations can be used on existing game models such as houses that have doors eg. The general syntax ishouse animate ["dvere1", 1]to 'open' the door and house animate ["dvere1",0] to 'close it'. Whether used on Oem addons, or official ones, an internal working knowledge (via config.cpp) of the model's animated name(s) is required.

'open' and 'close' are visual perceptions of the state of the model, and are a design decision of the p3d. Open does not, necessarily mean, 1, and close does not mean 0.
'0' and '1' are better seen as FULLY_OFF and FULLY_ON
If a door is initially closed in the model, FULLY_ON, will open it. If it is initialy OPEN visually, in the model, FULLY_ON will close it.

initphase = 1; (in config cpp) does not alter open and close meanings, all it does is set the model to the 'on' (rather than 'off') state to begin with. Whether on means open or close visually is a p3d design decision.
Posted on June 2011
Tyger
Also, to animate the object called "Bar Gate" in ArmA, use the following: myGate animate ["Bargate",1] to close it, and myGate animate ["Bargate", 0] to open it.

Bottom Section

Posted on February 16, 2016 - 21:33 (UTC)
RageBone
"Bargate" was exchanged with "Door_1_rot" at one point: object animate ["Bargate", 0]; // doesn't work object animate ["Door_1_rot", 0]; // works
Posted on March 14, 2016 - 00:34 (UTC)
Killzone Kid
To animate bargate use animateSource: bargate animateSource ["Door_1_source", 1];
Posted on November 25, 2017 - 20:55 (UTC)
SteveStevenson
For pop-up targets, you can keep the target down (until you tell it to pop up) with: target1 animate ["terc", 1]; When you're ready for the target to pop up, you can use: target1 animate ["terc", 0]; With this setting, the target will return to its usual behavior of going down when hit and automatically popping back up again. To make the target stay down after being hit, add the following line: target1 addEventHandler ["HitPart", { target1 animate ["terc", 1]; }];