B3d format and animation

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
CodeDog
Posts: 106
Joined: Sat Oct 07, 2006 8:00 pm
Location: CA. USA
Contact:

B3d format and animation

Post by CodeDog »

I got a B3d animated model into a test app with the new irrlicht 1.1 b3d loader however I don't see a getB3DJointNode function. I see a getXJointNode and a getMS3DJointNode.
I have looked at a b3d file in a hex editor and I believe the join name information is in the b3d file but is not being set to the node name when the file is loaded by the b3d loader. I see the joint name strings embedded in the file, single byte chars not wide or unicode.
I tried to write my own node finder that would traverse a node tree looking for a specified name but all the node names were set to empty string.

Any suggestions how I could get a pointer to the hand node on a b3d loaded mesh?
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Sorry, I forget to add that when I first released the b3d loader, I’ve added it now so if you use the SVN, getB3DJointNode is there. If you don’t want to use the SVN you could use a patch or you could wait till the next version of irrlicht.
CodeDog
Posts: 106
Joined: Sat Oct 07, 2006 8:00 pm
Location: CA. USA
Contact:

Post by CodeDog »

Thanks Luke. I did a SVN checkout last night. However, I didn't have the directx SDK installed so I couldn't compile it. The SDK is installing right now so I will be able to compile irlicht shortly. I'm glad to hear that the function to get the joint is in there. When I did the check out last night I was thinking I was going to have to root around in the B3D loader and add it myself.

Maybe instead of all these separate Get[modeltype]JointNode() functions we should have a virtual function named GetJointNode in the parent class and have it defined in each of the subclasses. For default the virtual function could give the nodes generic text names like "node1"...node2...node3... node5 for those model types that don't have any joint name information in the model file.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Yeah I agree,
There could simply be a function GetJointNode that calls GetXJointNode, GetB3dJointNode, getMS3DJointNode based on the type of mesh it is. But this is an interface thing so it’s probably more for the Irrlicht team. but this would be cool, and wouldn’t break any code if the old functions are kept.
TheC
Posts: 93
Joined: Fri May 05, 2006 7:50 am

Post by TheC »

Luke, Could you please generate a patch file if you have some time? I'm not using the SVN as I've got a heavily modified version already, this function is fairly vital to me, as all my models are b3d.

Thanks
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

TheC:

When I have some spare time I’ll make one up

Remind me if I forget :)
CodeDog
Posts: 106
Joined: Sat Oct 07, 2006 8:00 pm
Location: CA. USA
Contact:

Post by CodeDog »

You wouldn't need to worry about figuring out what type of model it is to implement a GetJointNode. If it was in the base class and defined in the child classes then it would be called polymorphicly from a pointer to the base class. Although, you are right, it should be done by the person in charge of the base classes.

If you put a patch together I'd be interested in it also. The SVN version works for me as far as the b3d files go but it broke the 3rd person camera I've been using. In fact the SVN version breaks ALL the user coded cameras I've found except the built in FPS and MAYA cams.
They have made some changes to the way events and view frustums are done.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

hi!
i'm using irrlicht 1.4 and i can't find getB3DJointNode too.. where can i get the patch?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

With Irrlicht 1.4 you have a generalized access, independent of the file format. Check the API for the Joint methods of ISkinnedMesh.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

oh, so i can't use the getB3DJointNode?
then could you show me a little example please?
gheft
Posts: 34
Joined: Mon Jul 30, 2007 4:11 am

Post by gheft »

getB3DJointNode is now just getJointNode

this might also be helpful http://www.irrlicht3d.org/wiki/index.ph ... tionSystem
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

thanks for the answer and for the site!

but still have problem:

Code: Select all

	model->node->setJointMode(EJUOR_READ);
	weapon = Game.smgr->addAnimatedMeshSceneNode(Game.smgr->getMesh("katana.b3d"));
	IBoneSceneNode *connect = model->node->getJointNode("katana");
	connect->addChild(weapon);
it dies with access violation... at the first line..
whatever i put to first, it dies, when it comes to joint.. why? should i init something before it? (the node is loaded)

edit: ohh i'm sorry, my fault.. ^^; i forgot that i loaded the model to tmp, and placed to "model" after that.. ^^; it doesn't crash now, however, a little funny :D but i think, i can do it from now. thank you!^^
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

hi!
still have a problem..
it's successfully attachet to the joint (weapon to the hand), but when i'm moving my character, then the weapon is slow.
so, when i'm forwarding, the weapon comes after my character, but slowly (not same as my chara).
but when i stop, it slowly returns to the charas hand..
how can i do that it go at the SAME speed?

Code: Select all

	weapon_models[0] = Game.smgr->getMesh("katana.b3d");

	weapon = Game.smgr->addAnimatedMeshSceneNode(weapon_models[0]);
	weapon->setPosition(vector3df(0,0,0));
	hand = tmp->node->getJointNode("katana_start");
	hand->addChild(weapon);

Code: Select all

void CGame::Render()
{
	driver->beginScene(true, true, video::SColor(0,220,220,255));

	player->UpdateJoints();
	// render the scene
	smgr->drawAll();

Code: Select all

void Player::UpdateJoints()
{
	model->node->animateJoints();
	weapon->animateJoints();
	weapon->setRotation(vector3df(0,-90,0));
	weapon->setPosition(model->node->getJointNode("katana_start")->getPosition());
}
and an other question:
i can make that my model connects to a joint. so, my weapons 0,0 goes to my characters joint. but can i do that joint connets to joint?
so

Code: Select all

	weapon = Game.smgr->addAnimatedMeshSceneNode(weapon_models[0]);
	weapon->setPosition(vector3df(0,0,0));
	middle = weapon->getJointNode("katana_middle");
	hand = tmp->node->getJointNode("katana_start");
	hand->addChild(middle);
for example for long weapons, when i have to place my characters hand. but the place is different for other weapons.
can i do it?
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

why do you have this code:

Code: Select all

weapon->setRotation(vector3df(0,-90,0));
weapon->setPosition(model->node->getJointNode("katana_start")->getPosition());
if the weapon is already parented?


and not sure what you mean with the other question.
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

ohh, the position setting is unuseful.. just i was trying to correct the problem..
and the rotation is because... the weapons rotation is different from the joint. so when i put the weapon to his hand, then it draws to right.. it's my fault (because my model should be rotated), but this doesn't have relation to my problem (it's bad when i don't use that too)

and the other question...
i want to connect two joints from two different models.
i can connect model to joint, but can i connect joint to joint?
Post Reply