Attach hair mesh to animated character dynamically

Hi guys - first of all our apoligies for any English typos (English is not our mother tongue) and also because of our lack of knowledge related to JME - we’ve just ‘landed’ here very recently.

The problem we have is that we are trying to attach a hair mesh to an animated character on-the-fly, but we can’t figure out how. In short, this is what we have:

  • An animated character in Ogre3D (XML) format. It comes with a .mesh, a.skeleton, a .material file and also several textures. The character is “bald” in the sense that there are different model meshes for the hair of the character, and we’d like to change the active hair at runtime.
  • We also have .mesh and .skeleton for the hair.

So basically what we presumably need here is to have access to the joints of the character and attach the hair mesh to one of the meshes, somehow.

Any ideas or suggestions? We’d really appreciate any help here, we’re seriously screwed with this!

Thanks a lot in advance!

PS: Sorry again if this topic has been already covered or it is trivial to solve

1 Like

Grab the skeletonControl on the model and use the getAttachementNode(BoneName) method.
It’ll return a node on which you can attach your hair geometry. Of course you’ll need to do this on the head bone.
You May have to adjust local transforms of the geometry so it fits the head correctly, but the hairs will follow the head during the animation.

1 Like

Hi nehon,

I´ve followed your instructions and I´ve solved my problem very fast.
Thanks a lot for your quick reply and your help.

1 Like