Category: Objects
/ Display
Since engine version: 1.0 OC
SetAttachBones
Description
If a mesh was previously attached to another mesh then this function can be used to change one or both of the bones at which they are attached. To only change a single bone the other parameter can be set to
nil
.Syntax
bool SetAttachBones(int attach_number, string parent_bone, string child_bone);
Parameters
- attach_number:
- Number of the attached mesh. The return value of AttachMesh provides such a number.
- parent_bone:
- [opt] Bone of the calling object at which to attach the mesh.
- child_bone:
- [opt] Bone of the object to be attached.
Example
func FxIntCarryBowStart(object target, effect) { effect.mesh = target->AttachMesh(Bow, "pos_hand1", "main"); effect.inhand1 = true; } func FxIntCarryBowTimer(object target, effect) { if(effect.inhand1) target->SetAttachBones(effect.mesh, "pos_hand2", nil); else target->SetAttachBones(effect.mesh, "pos_hand1", nil); effect.inhand1 = !effect.inhand1; }
Script for an effect: Initially the clonk carries a bow and for each timer call the bow is switched from its left hand to its right hand or vice versa.