{"name":"animateDoor","operator":null,"title":"animateDoor","type":"command","url":"https://community.bistudio.com/wiki/animateDoor","revid":347589,"updated":"2023-09-28T20:03:54Z","groups":["Animations"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma3","name":"Arma 3","version":"0.50"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":"global","server_exec":false},"exec":null,"description":"Animates a door on a vehicle. Animation is defined in config file in CfgVehicles -> AnimationSources. Wanted animation phase is set with phase param. This command works only on animation sources with \"door\" controller. Door_L in the example below can be animated with animateDoor but not CargoRamp_Open: `heli animateDoor [\"Door_L\", 1];`\n\n> [!IMPORTANT]\n> animateDoor `phase` param will be rounded: anything >0.5 will be rounded to 1 and <=0.5 will be rounded to 0. Therefore it is not possible to open a door half way with this command\n\n```cpp\nclass AnimationSources\n{\n    class CargoRamp_Open\n    {\n        source = \"user\";\n        animPeriod = 5;\n        initPhase = 0;\n    };\n    class Door_L\n    {\n        source = \"door\";\n        animPeriod = 1.6;\n    };\n};\n```\n\nTo animate doors or other sources that have \"user\" controller, use animate command, or even better, animateSource (recommended). Sources with \"hit\" controller can be animated with setHitPointDamage command applied to the name contained in hitpoint property. For availability of animation sources and their controller types see: Arma 3: createVehicle/vehicles","syntaxes":[{"syntax":"object animateDoor [doorname, phase, instant]","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"object: Object"},{"name":"doorname","type":"String","optional":false,"default":null,"description":null,"types":["String"],"since":null,"text":"doorname: String"},{"name":"phase","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"phase: Number"},{"name":"instant","type":"Boolean","optional":true,"default":"false","description":"when true and phase is either 0 or 1, door will change phase instantaneously","types":["Boolean"],"since":null,"text":"instant: Boolean - (Optional, default false) when true and phase is either 0 or 1, door will change phase instantaneously"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"[doorname, phase, instant]","types":["Array"]}}],"examples":[{"text":"```sqf\nTaru animateDoor [\"Door_1_source\", 1];\n```","code":["Taru animateDoor [\"Door_1_source\", 1];"]},{"text":"Open left front door on Ifrit instantly:\n\n```sqf\nIfrit animateDoor [\"Door_LF\", 1, true];\n```","code":["Ifrit animateDoor [\"Door_LF\", 1, true];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["doorPhase","setFaceAnimation","animate","animationPhase","animateSource","animationSourcePhase","animationNames"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Animations","Introduced with Arma 3 version 0.50","Scripting Commands","Scripting Commands: Global Effect"]}