How to parent mesh to armature bone?

New here. I wanted to know that how to get parent the mesh to armture bone to script. Reason is that I wanted the character to switch tools when equip type of weapon when assign to handle. Tried to look at the example on github not sure if I found it. I wanted to make sure the mesh took move with the animation later.

On update function :

  1. get bone position
  2. move object to bone position
  3. rotate object to bone rotation (use rotation offsets if the object rotations origin is not reset)

You can parent an empty object to armature bone in Blender, and afterwards parent your weapon to this empty object like usual.

I have added an example which should do what you are looking for. To run it properly use the armory updater first. Press X key to equip axe or sword.

Let me know if that works!

1 Like

Oh example help out. Tested. Does it position to head or tail? Got off position. At least got where to general area to code or blender model setup.

You got off position in the animation_bonechild example? Did you update armory like mentioned? Or are you talking about a different blend?

Oh I see. It hard to tell if the update is done. It should say sdk update. Since there are done text logs.

The Update SDK recommends to then relaunch Blender to use the new SDK. That may have caused your trouble.

When parenting a bone to an empty, will the bone keep all the behaviors we set on it and that we can test in Pose Mode, like bone constraints, not connected, axe IK limitations, etc… or do we have to reset all thoses constraints with Haxe code in Armory ?