animate: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) |
Lou Montana (talk | contribs) m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *R([a-z ])" to "$1 - r$2") |
||
(5 intermediate revisions by the same user not shown) | |||
Line 32: | Line 32: | ||
* It is recommended that [[animateSource]] command is used instead of [[animate]] whenever is possible, as it is more efficient and optimised for multiplayer | * It is recommended that [[animateSource]] command is used instead of [[animate]] whenever is possible, as it is more efficient and optimised for multiplayer | ||
* Since {{arma3}} v1.58 animation names can be obtained with [[animationNames]]}} | * Since {{arma3}} v1.58 animation names can be obtained with [[animationNames]]}} | ||
{{Feature| | {{Feature|warning|Mixing [[animateSource]] command with [[animate]] command to animate the same part may produce some undefined behaviour.}} | ||
|s1= object [[animate]] [animationName, phase, speed] | |s1= object [[animate]] [animationName, phase, speed] | ||
Line 38: | Line 38: | ||
|p1= object: [[Object]] | |p1= object: [[Object]] | ||
|p2= animationName: [[String]] - | |p2= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config | ||
|p3= phase: [[Number]] - | |p3= 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 | ||
|p4= speed: [[Boolean]] or [[Number]] - | |p4= speed: [[Boolean]] or (since {{GVI|arma3|1.66|size= 0.75}}) [[Number]] - (Optional, default [[false]]) when [[true]] animation is instant; [[Number]] > 0 is treated as config speed value multiplier | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= < | |x1= <sqf>_building animate ["maindoor", 1];</sqf> | ||
|x2= < | |x2= <sqf>_building animate ["Door_1_rot", 1, true];</sqf> | ||
|x3= Create Offroad and add flashing police light bar:< | |x3= Create Offroad and add flashing police light bar: | ||
offroad | <sqf> | ||
offroad | offroad = "C_Offroad_01_F" createVehicle (player getRelPos [5, 0]); | ||
offroad animate ["HidePolice", 0]; | |||
offroad animate ["BeaconsStart", 1]; | |||
</sqf> | |||
|seealso= [[animationPhase]] [[setFaceAnimation]] [[animateSource]] [[animationSourcePhase]] [[animateDoor]] | |seealso= [[animationPhase]] [[setFaceAnimation]] [[animateSource]] [[animationSourcePhase]] [[animateDoor]] [[doorPhase]] [[animationNames]] | ||
}} | }} | ||
{{Note | |||
|user= Mikero | |||
|timestamp= 20070823225000 | |||
|text= Animations can be used on existing game models such as houses that have doors eg. The general syntax is | |||
<sqf>house animate ["dvere1", 1]</sqf> | |||
to 'open' the door and <sqf>house animate ["dvere1", 0]</sqf> 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.<br> | |||
<br> | <br> | ||
'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. <br> | '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.<br> | ||
'0' and '1' are better seen as FULLY_OFF and FULLY_ON<br> | '0' and '1' are better seen as FULLY_OFF and FULLY_ON<br> | ||
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.<br> | 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.<br> | ||
<br> | <br> | ||
{{hl|c= 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. | {{hl|c= 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. | ||
}} | |||
{{Note | |||
|user= Tyger | |||
|timestamp= 20081206082300 | |||
|text= Also, to animate the object called "Bar Gate" in ArmA, use the following: <sqf>myGate animate ["Bargate",1]</sqf> to close it, and <sqf>myGate animate ["Bargate", 0]</sqf> to open it. | |||
}} | |||
< | |||
< | |||
{{Note | |||
|user= RageBone | |||
|timestamp= 20160216213300 | |||
< | |text= "Bargate" was exchanged with "Door_1_rot" at one point: | ||
<sqf>object animate ["Bargate", 0]; // doesn't work</sqf> | |||
<sqf>object animate ["Door_1_rot", 0]; // works</sqf> | |||
}} | |||
{{Note | |||
|user= Killzone_Kid | |||
|timestamp= 20160314003400 | |||
|text= To animate bargate use [[animateSource]]: | |||
<sqf>bargate animateSource ["Door_1_source", 1];</sqf> | |||
}} | |||
For pop-up targets, you can keep the target down (until you tell it to pop up) with: | {{Note | ||
< | |user= SteveStevenson | ||
|timestamp= 20171125205500 | |||
|text= For pop-up targets, you can keep the target down (until you tell it to pop up) with: | |||
<sqf>target1 animate ["terc", 1];</sqf> | |||
When you're ready for the target to pop up, you can use: | When you're ready for the target to pop up, you can use: | ||
< | <sqf>target1 animate ["terc", 0];</sqf> | ||
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: | 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: | ||
< | <sqf>target1 addEventHandler ["HitPart", { target1 animate ["terc", 1]; }];</sqf> | ||
}} | |||
Latest revision as of 15:47, 8 November 2023
Description
- Description:
- Activates given object animation. Animation is defined in CfgModels animations class. Class names listed in CfgVehicles AnimationSources bound to "Proxy" controller can also be animated with animate command (see Arma 3: createVehicle/vehicles).
- Groups:
- Animations
Syntax
- Syntax:
- object animate [animationName, phase, speed]
- Parameters:
- object: Object
- 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 (since 1.66) Number - (Optional, default false) when true animation is instant; Number > 0 is treated as config speed value multiplier
- Return Value:
- Nothing
Examples
- Example 1:
- _building animate ["maindoor", 1];
- Example 2:
- 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:
- animationPhase setFaceAnimation animateSource animationSourcePhase animateDoor doorPhase animationNames
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
- Posted on Aug 23, 2007 - 22:50 (UTC)
-
Animations can be used on existing game models such as houses that have doors eg. The general syntax is
to 'open' the door andhouse animate ["dvere1", 1]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.house animate ["dvere1", 0]
'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 Dec 06, 2008 - 08:23 (UTC)
-
Also, to animate the object called "Bar Gate" in ArmA, use the following: to close it, andmyGate animate ["Bargate",1]to open it.myGate animate ["Bargate", 0]
- Posted on Feb 16, 2016 - 21:33 (UTC)
-
"Bargate" was exchanged with "Door_1_rot" at one point:
- Posted on Mar 14, 2016 - 00:34 (UTC)
-
To animate bargate use animateSource:
- Posted on Nov 25, 2017 - 20:55 (UTC)
-
For pop-up targets, you can keep the target down (until you tell it to pop up) with:
When you're ready for the target to pop up, you can use:target1 animate ["terc", 1];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 animate ["terc", 0];
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.75
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Operation Flashpoint: Elite: Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Animations
- Scripting Commands: Global Effect