How to attach objects to bones at the right position?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
rh73
Posts: 2
Joined: Sat Jul 07, 2012 1:02 pm

How to attach objects to bones at the right position?

Post by rh73 »

I have an animated mesh with a skeleton (created with Blender, exported as .X). Now I want to attach objects (armor, weapon, ...) to the bones. When I simply set the bone node of, for example, the right hand as parent to the node representing the sword, I get the unexpected result that the sword is following the hand, but at ground level. The X position however is correct, it's at the right sight of the body just below the hand. When I try to change it's Y position (set Y / height to where approximately the hand is) before parenting it starts rotating way too heavy because the pivot point seems to stay at ground level.

I searched for tutorials/examples on how to solve such a rather basic task, but couldn't find any. I guess I could somehow manually translate the equipment nodes in the update loop, but on the other hand that's what the parenting system is supposed to automatically do for me, right? I feel like I'm doing something wrong / missing something, but I'm fairly new to Irrlicht so I would greatly appreciate some help here.

EDIT: I tried around a bit more and am getting more and more confused. I seems the rotation around some but not all axises is mirrored for the child object. Example: parent bone rotates clockwise around Z, child object rotates counter-clockwise around Z. However for the other axises the rotations are in sync. Very strange.
rh73
Posts: 2
Joined: Sat Jul 07, 2012 1:02 pm

Re: How to attach objects to bones at the right position?

Post by rh73 »

Ok. I found a fix for my problem, but it's not 100% satisfying:

I tried exporting the animated model in Blender for a right-handed system instead of a left-handed system. Now the child objects get attached to the correct places and the rotation is fine, too. But my model is mirrored, naturally. I could live with that, but it means mirroring textures (and models as well in case they are asymmetrical), renaming the bones (R <->L) etc. which feels just wrong even if it's a simple task which could be automated.

Anyways, now that I have a scenario that works I hope somebody understands better what my problem is and can explain to me what is going on and how to do it right?
Nobby
Posts: 3
Joined: Fri Jul 20, 2012 7:04 am

Re: How to attach objects to bones at the right position?

Post by Nobby »

I have the same problem. Could you please explain me how you get the node (as parent node for the child mesh) of the right hand of an animated X character? Using irrEdit, I only can select the whole model but not the hand or head.
Thx, Nobby
Post Reply