[Solved] blender -> .b3d -> irrlicht misses bones

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
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

[Solved] blender -> .b3d -> irrlicht misses bones

Post by MrJones »

Hi,

I modelled a character in blender and now I'd like to use it in Irrlicht.

The special thing about that model is, it has rigged armatures (only partially for the legs as you will notice, but that's enough for a start to test whether import/export works) but NO animations (I think about doing them purely in irrlicht with code by placing the bones accordingly, I'm yet undecided about that).

Now when exporting that model from blender to .b3d using an improved version of Gandaldf's .b3d exporter and importing it into Irrlicht, I have trouble to obtain a bone named "legL_U". I just get a NULL pointer (in Irrlicht 1.7.1).

Code: Select all

        IAnimatedMesh* mesh = smgr->getMesh("data/girl.b3d");
	if (!mesh) {
		dev->drop();
		return 1;
	}
        IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
	if (!node) {return 1;}
	node->setMaterialFlag(EMF_LIGHTING, true);
	node->setMaterialFlag(EMF_ANISOTROPIC_FILTER, true);
	//node->setTransitionTime(1.0f);
	//node->setJointMode(irr::core::EJUOR_CONTROL);
	
	IBoneSceneNode* leg_node = node->getJointNode("legL_U");
        //leg_node is now NULL
I have no idea what's wrong. Therefore, I have packaged the .blend file, the resulting .b3d file, the needed skin texture and the exporter (which I originally got from here) into a single .zip archive (click for download) for an expert's examination.

I really don't know what I'm doing wrong (also I'm a bloody beginner with bones), so any help would be appreciated. Basically, I simply want the bones to be in Irrlicht so I can mess around with them and animate the model with the help of them (without actually adding any animation frames to the model file itself, just raw bones).
Last edited by MrJones on Sun May 23, 2010 5:10 pm, edited 1 time in total.
blub
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

Post by MrJones »

Wow, I simply had to insert any sort of keyframe. I wonder why I haven't come up with this for hours.

Still, I'm having a little other problem now. Given I obtain the leg_node as described above and use the following code always before drawAll() ...

Code: Select all

if (leg_node) {
   printf("rotating\n");
   leg_node->setRotation(EulerFromQ(quaternion(DEGTORAD*leg_node->getRotation())*quaternion(DEGTORAD*vector3df(2,2,0))));
}
(whereas EulerFromQ is this little convenience function for quaternion->euler angle conversion I wrote:

Code: Select all

vector3df EulerFromQ(quaternion q) {
	vector3df b;
	q.toEuler(b);
	b *= RADTODEG;
	return b;
}
)

... then stdout is spammy with "rotating" messages but the leg simply doesn't rotate. You can check in the model that it has vertex groups attached (also animating works fine in blender itself). Do I need to call some other function so the node's animation gets actually updated from the bones' new rotations/positions?

Edit: I was simply missing node->setJointMode(EJUOR_CONTROL); - as you can see above I had commented it out
blub
Post Reply