# AttachMesh

Objects
Display
5.1 OC
int
any mesh ID or object of the mesh to be attached.
string parent_bone Bone of the calling object's mesh at which to fix the mesh to be attached.
string child_bone Bone of the object to be attached with which to fix it.
array transformation Transformation to be applied on the attached mesh in its own frame of reference. The array should consist of 12 integer entries which make up a 3x4 matrix in which each vaule is given in promille (1000 = 100%). These matrices can be created via Trans_Identity, Trans_Translate, Trans_Rotate and Trans_Scale or they can be combined via Trans_Mul.
int flags Additional flags to specify the behavior of the attached mesh. Multiple values can be separated with `|`. The following values are allowed:

Flag
Description
AM_DrawBefore
Normally the mesh of the object itself is drawn first and afterwards the attached mesh. If this flag is present then the attached mesh is drawn before the object's mesh is drawn. Note that normally this makes no difference since a Z buffer is used to make sure the drawing order is correct. However if one or both of the meshes make use of alpha blending then the drawing order becomes relevant so that a mesh is not hidden behind otherwise (partly) translucent parts of the other mesh.

Attaches a mesh to another mesh. If `mesh` is an ID then the mesh of the corresponding definition is used. If `mesh` is an object then the current mesh of that object is used, including all its animations and attached meshes. However, in that case only the graphics will be attached - the object itself stays at its current position. The return value is a number that can be used to detach the mesh again via DetachMesh.
If an object is used for a mesh then the "MeshTransformation" property of the attached mesh will not be applied. Instead the parameter `transformation` can be used to transform the attached mesh.
AttachMesh
(Bow, "pos_hand1", "main");
If executed in the context of a clonk this script makes him carry a bow. The bow will be attached with its bone called "main" to the bone called "pos_hand1" of the clonk.
DetachMesh
SetAttachBones
SetAttachTransform
Trans_Identitiy
Trans_Translate
Trans_Rotate
Trans_Scale
Trans_Mul
Clonk-Karl
2010-04