Category: Animations
Since engine version: 1.0 OC
SetAnimationWeight
Description
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.Syntax
bool SetAnimationWeight(int animation_number, array weight, int attach_number);
Parameters
- animation_number:
- Animation number of the animation whose position to set.
- weight:
- 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.
- attach_number:
- [opt] If given, refers to the number of the attached mesh whose animation to change.
Remark
See the animation documentation for further explanations of the animation system.
Example
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.