animate: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(description, wip)
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *R([a-z ])" to "$1 - r$2")
 
(73 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofpr |= Game name
|game1= ofp
|version1= 1.75


|1.75|= Game version
|game2= ofpe
|version2= 1.00


|arg= global |= Arguments in MP
|game3= arma1
|version3= 1.00


|eff= global |= Effects in MP
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| Activates given object animation. Animation is defined in CfgModels ''Animations'' class of model.cfg or another model config. To animate door of the house from example below: <tt>house [[animate]] ["Door_1_rot", 1];</tt>
|game5= arma2oa
<syntaxhighlight lang="cpp">
|version5= 1.50
class Animations
{
class Door_1_rot
{
type = rotation;
source = Door_1_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_1
{
type = rotation;
source = Door_1_handle_source;
selection = Door_Handle_1;
axis = Door_Handle_1_axis;
memory = 1;
minValue = 0;
maxValue = 0.1;
angle0 = 0;
angle1 = (rad -50);
};
};</syntaxhighlight>


Since model.cfg is not always available for reference, most animation names could also be obtained from [[animationNames]] command.
|game6= tkoh
|version6= 1.00


{{Feature arma3| It is recommended that [[animateSource]] command is used instead of [[animate]] as it is more efficient and  optimised for MP and uses animation sources from main config}}|= Description
|game7= arma3
____________________________________________________________________________________________
|version7= 0.50


| objectName '''animate''' [animationName, phase, now] |= Syntax
|arg= global


|p1= objectName: [[Object]] |= Parameter 1
|eff= global


|p2= [animationName, phase, instant]: [[Array]] |= Parameter 2
|gr1= Animations


|p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config. |= Parameter 3
|descr= Activates given object animation. Animation is defined in CfgModels [[Model Config#Animations|animations]] class. Class names listed in CfgVehicles [[Model Config#AnimationSources|AnimationSources]] bound to "Proxy" controller can also be animated with [[animate]] command (see [[Arma 3: createVehicle/vehicles]]).
{{Feature|arma3|
* 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]]}}
{{Feature|warning|Mixing [[animateSource]] command with [[animate]] command to animate the same part may produce some undefined behaviour.}}


|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. |= Parameter 5
|s1= object [[animate]] [animationName, phase, speed]


|p5= now: [[Bool]] - [[true]]: animated instantly and without sound, [[false]]: normal animation (''since Arma 3 v1.47'') |= Parameter 4
|p1= object: [[Object]]


| [[Nothing]] |= Return value
|p2= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config


____________________________________________________________________________________________
|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
 
|x1= <code>_building [[animate]] ["maindoor", 1];</code> |= Example 1
|x2= <code>_building [[animate]] ["Door_1_rot", 1, [[true]]];</code> |= Example 2
____________________________________________________________________________________________


| [[animationPhase]], [[setFaceAnimation]], [[animateDoor]] |= See also
|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]]


<h3 style="display:none">Notes</h3>
|x1= <sqf>_building animate ["maindoor", 1];</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on Aug 2007
<dt class="note">'''[[User:Mikero|Mikero]]'''<dd class="note">Animations can be used on existing game models such as houses that have doors eg. The general syntax is house 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.
|x2= <sqf>_building animate ["Door_1_rot", 1, true];</sqf>
'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.
|x3= Create Offroad and add flashing police light bar:
<sqf>
offroad = "C_Offroad_01_F" createVehicle (player getRelPos [5, 0]);
offroad animate ["HidePolice", 0];
offroad animate ["BeaconsStart", 1];
</sqf>


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.
|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>
'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>
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>
{{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.
}}


<dd class="notedate">Posted on  June 2011
{{Note
<dt class="note">'''[[User:Tyger|Tyger]]'''<dd class="note">Also, to animate the object called "Bar Gate" in ArmA, use the following: <code>myGate [[animate]] ["Bargate",1]</code> to close it, and <code>myGate [[animate]] ["Bargate", 0]</code> to open it.
|user= Tyger
<!-- Note Section END -->
|timestamp= 20081206082300
</dl>
|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.
}}


<h3 style="display:none">Bottom Section</h3>
{{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>
}}


[[Category:Scripting Commands|ANIMATE]]
{{Note
[[Category:Scripting Commands OFP 1.99|ANIMATE]]
|user= Killzone_Kid
[[Category:Scripting Commands OFP 1.96|ANIMATE]]
|timestamp= 20160314003400
[[Category:Scripting Commands ArmA|ANIMATE]]
|text= To animate bargate use [[animateSource]]:
[[Category:Command_Group:_System_Commands|{{uc:{{PAGENAME}}}}]]
<sqf>bargate animateSource ["Door_1_source", 1];</sqf>
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= SteveStevenson
<dd class="notedate">Posted on June 21, 2015 - 16:41 (UTC)</dd>
|timestamp= 20171125205500
<dt class="note">[[User:LeClubBWA|LeClubBWA]]</dt>
|text= For pop-up targets, you can keep the target down (until you tell it to pop up) with:
<dd class="note">
<sqf>target1 animate ["terc", 1];</sqf>


With this command you can switch the offroad police lights on like this :<br>
When you're ready for the target to pop up, you can use:
<sqf>target1 animate ["terc", 0];</sqf>


<code>_vehicle animate ["BeaconsStart",1];</code>
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>
And switch it off :<br>
}}
 
<code>_vehicle animate ["BeaconsStart",0];</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->
 
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on February 16, 2016 - 21:33 (UTC)</dd>
<dt class="note">[[User:RageBone|RageBone]]</dt>
<dd class="note">
 
 
 
Aparently  "Bargate"  was exchainged with "Door_1_rot"<br>
 
Doesen't work:<br>
<code>object animate ["Bargate", 0];</code><br>
Works:<br>
<code>object animate ["Door_1_rot", 0];</code><br>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 16:47, 8 November 2023

Hover & click on the images for description

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).
Arma 3
  • It is recommended that animateSource command is used instead of animate whenever is possible, as it is more efficient and optimised for multiplayer
  • Since Arma 3 v1.58 animation names can be obtained with animationNames
Mixing animateSource command with animate command to animate the same part may produce some undefined behaviour.
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 Arma 3 logo black.png1.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:
_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:
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
Mikero - c
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
house 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.
Tyger - c
Posted on Dec 06, 2008 - 08:23 (UTC)
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.
RageBone - c
Posted on Feb 16, 2016 - 21:33 (UTC)
"Bargate" was exchanged with "Door_1_rot" at one point:
object animate ["Bargate", 0]; // doesn't work
object animate ["Door_1_rot", 0]; // works
Killzone_Kid - c
Posted on Mar 14, 2016 - 00:34 (UTC)
To animate bargate use animateSource:
bargate animateSource ["Door_1_source", 1];
SteveStevenson - c
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:
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]; }];