Category: Animations
Since engine version: 1.0 OC


Sets a new weight for the given animation. Returns true if the new AVP was set or false if there is no such animation with the given number or the refernced node is an animation node.


bool SetAnimationWeight(int animation_number, array weight, int attach_number);


Animation number of the animation whose position to set.
Specifies how to compute the weight of the animation in case the animation is combined with another animation in the given slot. The value needs to be created with one of the "Anim_" animation functions.
[opt] If given, refers to the number of the attached mesh whose animation to change.


See the animation documentation for further explanations of the animation system.


var angle = Angle(0, 0, GetXDir(), GetYDir());
if(angle > 360) angle = 360 - angle;
SetAnimationWeight(swim_comb, Anim_Const(500+Cos(angle, 500)));
If swim_comb contains the number of an animation node combining a "swim up" and "swim down" animation (refer to the example of PlayAnimation), then this script sets the a weight depending on the cosine of the current swimming direction.
See also: Anim_AbsX, Anim_AbsY, Anim_Action, Anim_Const, Anim_Linear, Anim_X, Anim_XDir, Anim_Y, Anim_YDir, GetAnimationPosition, GetAnimationWeight, PlayAnimation, SetAnimationPosition
Clonk-Karl, 2010-01