Since engine version: 4.0 OC
This function is very similar to PlayAnimation. Instead of playing an animation which is pre-defined in the skeleton of the mesh, it allows individual bones to be transformed arbitrarily. The transformation is inserted as a leaf node into the animation tree for the given slot. The return value of this function is the animation number of the animation node inserted which can be used to manipulate or remove the animation later. If there are already animations in the given slot then additionally a combination node is created. This combination node is assigned the returned number plus 1.
int TransformBone(string bone, array transformation, int slot, array weight, int sibling, int attach_number);
- Name of the bone to be transformed.
- Slot in the animation stack in which the animation should be inserted. See Animations.
- Specifies how to compute the weight of the bone transformation in case it is combined with another animation in the given slot. The value needs to be created with one of the "Anim_" animation functions.
- [opt] If the bone transformation is combined with another animation then this refers to the node with which the new node is combined. If not given or
nilthen the animation is combined with the animation at the top of the slot as returned by GetRootAnimation.
- [opt] If given, refers to the number of the attached mesh to use instead of the object's main mesh.
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.
TransformBone("skeleton_arm_upper.R", Trans_Rotate(90, 0, 1, 0), 5, Anim_Const(1000));
Rotates the right arm of a Clonk by 90 degrees around the Y axis (in bone coordinates).