For clothes, I use the same exact bone structure as the respective character model and export that as a b3d file and it gets loaded into Irrlicht as an IAnimatedMesh. I then position that in the right spot on the npc and use a loop that takes all the bone rotations and positions from the npc mesh and copies that to the bones on each clothing mesh. The trick to make this work is to do
Code: Select all
bone->setAnimationMode(EBAM_UNANIMATED);Code: Select all
node->setJointMode(EJUOR_CONTROL);This works but it's slow. It turns out rendering a mesh with the
Code: Select all
EJUOR_CONTROLThere is however another way. A faster way. If I instead, in Blender, assign the same exact animations that's on my npc model's armature onto the clothing armature, then I make my code simply make the animation frame of the clothing equal to the animation frame of the npc model at all times, this works great and is really fast. The code to do this is really simple one-liner that runs on every frame:
Code: Select all
clothing->getNode()->setCurrentFrame(getNode()->getFrameNr());My idea: what if I found a way to extract the animation data from my main npc mesh and somehow inserted it into the clothing meshes? That way it copies all the animations from 1 source and I don't have to worry about clothing always having the same animations as the npc model.
Is such a thing possible in Irrlicht? Where would I even begin? Would I be better off reverse engineering the Blender b3d exporter to figure out how to process this data and then make it in c++ so my game can do it while loading resources or is there a way involving Irrlicht that this can be done easier? Maybe there's a way with getMeshBuffer for example.

