TransformBone

Kategorie: Animationen
Ab Engineversion: 4.0 OC

Beschreibung

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.

Syntax

int TransformBone(string bone, array transformation, int slot, array weight, int sibling, int attach_number);

Parameter

bone:
Name of the bone to be transformed.
transformation:
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.
slot:
Slot im Animation Stack in den die Animation eingefügt werden soll. Siehe Animationen.
weight:
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.
sibling:
[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 nil then the animation is combined with the animation at the top of the slot as returned by GetRootAnimation.
attach_number:
[opt] If given, refers to the number of the attached mesh to use instead of the object's main mesh.

Anmerkungen

Siehe die Animations-Dokumentation für eine Beschreibung des Animationssystems.
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.

Beispiel

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).
Siehe auch: PlayAnimation, SetAnimationBoneTransform, StopAnimation
Clonk-Karl, 2013-05