animate: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(description, wip)
Line 11: Line 11:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Process a linear animation on an object. Such animations are only used in user-made addons, they can be defined in the addon's config.cpp. |= Description
| 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>
<syntaxhighlight lang="cpp">
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.
 
{{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
____________________________________________________________________________________________
____________________________________________________________________________________________


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


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


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


|p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the addon's config.cpp. |= Parameter 3
|p3= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the config. |= Parameter 3


|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 4
|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
 
|p5= now: [[Bool]] - [[true]]: animated instantly and without sound, [[false]]: normal animation (''since Arma 3 v1.47'') |= Parameter 4


| [[Nothing]] |= Return value
| [[Nothing]] |= Return value


| s2= objectName '''animate''' [animationName, phase, instant]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(''since Arma 3 v1.47'') |= Syntax
|p21= objectName: [[Object]] |= Parameter 1
|p22= [animationName, phase, instant]: [[Array]] |= Parameter 2
|p23= animationName: [[String]] - name of the animation. This is the class-name of the animation defined in the addon's config.cpp. |= Parameter 3
|p24= 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
|p25= instant: [[Bool]] - [[true]]: animated instantly and without sound, [[false]]: normal animation |= Parameter 4
| r2= [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>_building [[animate]] ["maindoor", 1];</code> |= Example 1
|x1= <code>_building [[animate]] ["maindoor", 1];</code> |= Example 1
|x2= <code>_building [[animate]] ["maindoor", 1, [[true]]];</code> |= Example 2
|x2= <code>_building [[animate]] ["Door_1_rot", 1, [[true]]];</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 00:26, 9 March 2016

Hover & click on the images for description

Description

Description:
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: house animate ["Door_1_rot", 1];
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);
	};
};

Since model.cfg is not always available for reference, most animation names could also be obtained from animationNames command.

Arma 3
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
Groups:
Uncategorised

Syntax

Syntax:
objectName animate [animationName, phase, now]
Parameters:
objectName: Object
[animationName, phase, instant]: 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.
now: Bool - true: animated instantly and without sound, false: normal animation (since Arma 3 v1.47)
Return Value:
Nothing

Examples

Example 1:
_building animate ["maindoor", 1];
Example 2:
_building animate ["Door_1_rot", 1, true];

Additional Information

See also:
animationPhasesetFaceAnimationanimateDoor

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 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.
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 June 21, 2015 - 16:41 (UTC)
LeClubBWA
With this command you can switch the offroad police lights on like this :
_vehicle animate ["BeaconsStart",1]; And switch it off :
_vehicle animate ["BeaconsStart",0];
Posted on February 16, 2016 - 21:33 (UTC)
RageBone
Aparently "Bargate" was exchainged with "Door_1_rot"
Doesen't work:
object animate ["Bargate", 0];
Works:
object animate ["Door_1_rot", 0];