Category: Animations
Since engine version: 4.0 OC


This function can be used to change the transformation of a bone set with TransformBone. This allows to create dynamic animations by script. Returns true if the new transformation was set or false if there is no such animation node or it was not created with TransformBone.


int SetAnimationBoneTransform(int animation_number, array transformation, int attach_number);


Animation number of the animation whose bone transformation to change. The animation must have been created with TransformBone.
An array with 12 entries representing a 3x4 transformation matrix in row-major order. These matrices can be created via Trans_Identity, Trans_Translate, Trans_Rotate and Trans_Scale or they can be combined via Trans_Mul.
[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.
The transformation passed to this function is not completely arbitrary, in particular it must not have components which skew the mesh along one of the axes. Skewing is not supported by the animation blending system. Skew matrices cannot be produced with one of the Trans_* functions directly, but it can result of the multiplication of a rotation matrix with a rotated scale matrix, e.g. Trans_Mul(Trans_Rotate(...), Trans_Scale(...), Trans_Rotate(...)). Skewing cannot occur by combining translation and rotation matrices only.


SetAnimationBoneTransform(animation_number, Trans_Rotate(FrameCounter() % 360, 0, 1, 0));
Script for a timer to be called each frame: The bone for which the animation with animation_number was started is turning with one revolution per 360 frames.
See also: StopAnimation, TransformBone
Clonk-Karl, 2013-05