Immediately applies given animation to the unit. For a smooth transition from the current animation (by connecting animations successively, e.g CurrentAnim -> Intermediate1 -> Intermediate2 -> TargetAnim), use playMove or playMoveNow.
This command first resets the unit's animation states (including aiming state, gesture state, etc.) then puts the unit in the first frame of the animation (therefore showing no transition).
If an invalid animation is provided, the unit's animations will be reset but no new animation will be played (see Example 3).
Note
It is a good practice to always use playMoveNow after switchMove to make sure the animation plays correctly when using the first syntax:
moveName: String - entry from "CfgMovesMaleSdr" >> "states" or "CfgGesturesMale" >> "states"
time: Number - (Optional, default 0) normalized time, in range 0..1, where 0 = beginning of the animation, and 1 = end of the animation
blendFactor: Number - (Optional, default 1) how much to blend the current animation with the new animation, in range 0..1, where 0 = current animation, and 1 = new animation. When 1 is used, the switching is instant (not smooth), similar to the first syntax.
resetAim: Boolean - (Optional, default true) whether the aim/head direction should be reset after switching
This command has a global effect when executed locally to the unit and will synchronise properly for JIP.
In this case the animation on the executing machine is immediate while on remote machines it will be transitional.
In order for the animation to change immediately on every PC in multiplayer, use global remote execution (see Example 2).
When the argument is remote, the animation change on the executing PC is only temporary.
In some cases the movement won't stay. I.e. AI hostages that put their hands behind their heads (_hostage switchMove "AmovPercMstpSsurWnonDnon") won't hold their hands up, unless you first use disableAI "autoTarget" on them. They mostly put their hands down because they 'noticed' unknown objects.
When using this command on the player unit outside unscheduled UI contexts, it will cause a minor camera glitch for a single frame.
For example, Draw3D and KeyDown are UI contexts and so are not affected by the glitch, but EachFrame and scheduled scripts are not UI contexts and are affected by the glitch.
Leopard20
If the animation you're trying to use with this command has no connection/interpolation to the unit's base animation (usually "AmovPercMstpSrasWrflDnon"), the move might not play using switchMove alone. In such cases you have to do this: