something wrong with the getXJointNode ?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
justiceforall

something wrong with the getXJointNode ?

Post by justiceforall »

I do that by
http://irrlicht.sourceforge.net/phpBB2/ ... node#16484

and can compile the Irrlicht Engine ,
I make a .3ds and .bip file with 3dmax , and export a people.x file,
and make a .3ds and NO .bip file with 3dmax , and export a people gun.x file,

and in .bip file ,the jointname is
Bip01_R_Hand,Bip01_L_Hand,Bip01_R_Finger0.....

but when I use the dll in my project,
1 . getXJointNode("Bip01_R_Hand");
the result is Joint with specified name not found in .X mesh.: Bip01_R_Hand

So i modify the engine,let the engine print out all joint names,only print
"Bip01"
when i use getXJointNode("Bip01") but no use ,the people and the gun no
attach !

So how can i know the para jointName in getXJointNode(const c8* jointName) ?how can i know what the jointName is ?

2. my code

mesh = smgr->getMesh("../../media/people.x");
scene::IAnimatedMeshSceneNode* anode1 = 0;
anode1 = smgr->addAnimatedMeshSceneNode(mesh);
anode1->setPosition(core::vector3df(-50,45,-140));

irr::scene::IAnimatedMesh* meshms3dgun = smgr->getMesh("../../media/gun.x");
irr::scene::IAnimatedMeshSceneNode* node_ms3dgun2 = smgr->addAnimatedMeshSceneNode(meshms3dgun);
if(node_ms3dgun2)
{
node_ms3dgun2->setAnimationSpeed(400);
node_ms3dgun2->setPosition(core::vector3df(-300,40,-140));
node_ms3dgun2->setVisible(true);
irr::scene::ISceneNode* hand = anode1->getXJointNode("Bip01a");
hand->addChild(node_ms3dgun2);

}

CAN some one help me to what is the reason and how to resolve ?
thanks.
sorry for my bad english.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

As the one who made that modification I feel a duty to reply. Regretably I have done little testing of it myself. Here are a few things to try

1) open your people.x file in DX meshviewer (available with the DX sdk or you can probably find a standalone download of it somewhere) and see what that says the joint names are. You could also try resaving from the meshviewer

2) try a test using the dwarf.x file included with irrrlicht, that's the only thing I've actually tested with. If that doesn't work it's possible you made a mistake in your code or in adding my modification.

3)
irr::scene::ISceneNode* hand = anode1->getXJointNode("Bip01a");
You said you tried "Bip01_R_Hand" and "Bip01" so what's with "Bip01a"?
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
UrPc
Posts: 4
Joined: Fri Jan 16, 2004 7:23 pm

Post by UrPc »

I also tried Electron's modification but the Positions returned were wrong.
I think that is a problem of the Hierarchy not calculated correctly in the engine, because the Joints move correctly but extremer and outside the mesh.
I have only two Joints who work perfect they are Bip01_L_Finger and Bip01_R_Finger Bip01_L_Foot works nearly perfect (R also) and
because they are at the bottom of the Hierarchy I think thats the Problem.

I think in this area of the Engine is much work to do...

To your Problem:
if

for(int i=0;i<meshX->getJointCount();i++)
{
cout << meshX->getJointName(i) << endl;
}

only returns Bip01 the Problem is not in the code. It's in your Model or in Irrlicht's XFileReader.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Hmm, thanks for bringing that to my attention. I pretty much copied and pasted the code for the ms3d version, so if the positions are wrong it's probably the engine's fault, though I could have messed up something. When I get a chance (or get to the point in my game where I actually need thsi code myself I will check it out more thoroughly. If the engine is giving a false position for complicated heirarchies it could be a quite low-level problem with lot's of nasty math :cry:

BTW: Has anyone observed if a model with complicated joint heirarchy gives correct joint positions with the ms3d joint node?
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
justiceforall

Post by justiceforall »

[/quote]
You said you tried "Bip01_R_Hand" and "Bip01" so what's with "Bip01a"?[/quote]


in the engine i print it ,
ISceneNode* CAnimatedMeshSceneNode::getXJointNode(const c8* jointName)
{
if (!Mesh || Mesh->getMeshType() != EAMT_X)
return 0;

IAnimatedMeshX* amm = (IAnimatedMeshX*)Mesh;
s32 jointCount = amm->getJointCount();
s32 number = amm->getJointNumber(jointName);

//i add it and print all the jointName
for(int i=0;i<=jointCount-1;i++)
{

printf("jointCount=%s\n",amm->getJointName(i));

}
......


but in my mesh ,when I make a .3ds and .bip file with 3dmax , and export a people.x file, and in .bip file ,the jointname is
Bip01_R_Hand,Bip01_L_Hand,Bip01_R_Finger0.....
so i think the engine can use the jointName Bip01_R_Hand,Bip01_L_Hand....
but the engine do not print Bip01_R_Hand,Bip01_L_Hand....
and only print "Bip01a",

why engine do not print the jointName when i do in the 3dmax ?
is the bug in engine?
HOW can i to resolve it ?

thanks for you help!
justiceforall

Post by justiceforall »

Electron wrote: You said you tried "Bip01_R_Hand" and "Bip01" so what's with "Bip01a"?

i open people.x file in DX meshviewer and see all the joint names are.

but I found that ,the engine print
Unknown Joint referenced in x file: Bip01_R_Hand
Unknown Joint referenced in x file: Bip01_L_Hand
Unknown Joint referenced in x file: Bip01_R_Finger0
.....

CXAnimationPlayer: Animationtrack without corresponding joint found: Bip01_R_Hand
CXAnimationPlayer: Animationtrack without corresponding joint found: Bip01_L_Hand
CXAnimationPlayer: Animationtrack without corresponding joint found: Bip01_R_Finger0

why the engine do not konw all the jointnames,only konw one of them?
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

justiceforall wrote: CXAnimationPlayer: Animationtrack without corresponding joint found: Bip01_R_Hand
why the engine do not konw all the jointnames,only know one of them?
Okay, that makes it definite. Either the engine is loading your .x file incorrectly or something is messed up in the .x file itself. Have you resaved the file in DX meshviewer? If resaving in DX meshviewer doesn't make a difference, I strongly suggest using a different .x file. Regardless of my added function, I don't think the engine likes this one.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
justiceforall

Post by justiceforall »

Electron wrote:Okay, that makes it definite. Either the engine is loading your .x file incorrectly or something is messed up in the .x file itself. Have you resaved the file in DX meshviewer? If resaving in DX meshviewer doesn't make a difference, I strongly suggest using a different .x file. Regardless of my added function, I don't think the engine likes this one.
yes ,u are right, i do that what you said, and the engine print all the jointnames ,it is OK. thank u very much.

but is what UrPc said a bug of engine?
i find the the Positions of the gun between the people were wrong,
the gun move correctly ,but it outside the people.

how can i resolve it ?
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

justiceforall wrote: but is what UrPc said a bug of engine?
i find the the Positions of the gun between the people were wrong,
the gun move correctly ,but it outside the people.
how can i resolve it ?
Could someone who has milkshape (or any other tool that can export animated .ms3d) and test a similar model with the engine's own function? If movement is incorrect then yes,it is a bug in the engine and would probably require some low-level digging to fix. If the .ms3d works fine then there is a bug in my code and I will work to fix it.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
UrPc
Posts: 4
Joined: Fri Jan 16, 2004 7:23 pm

Post by UrPc »

It doesn't work with ms3d modells, too.

And getMatrixOfJoint returns the same false Position...
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

crud. Guess someone should post this in the bug reports forum then
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
justiceforall

Post by justiceforall »

Electron wrote: Could someone who has milkshape (or any other tool that can export animated .ms3d) and test a similar model with the engine's own function? If movement is incorrect then yes,it is a bug in the engine and would probably require some low-level digging to fix. If the .ms3d works fine then there is a bug in my code and I will work to fix it.
I make a test with milkshape and find movement is correct but the position is INcorrect, just like .x do. so I guess this is a bug in engine.

i will report it to the bug forum and want the author to fix it in next version.
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

i saw this too

Post by buhatkj »

like the first week 0.6 came out i tried this, intending to make it a TPIM patch for 0.6, but all the joint node were inverted across the middle of the model. for example, if i use the dwarf model, and attach a sword the the joint for his left hand, the sword gets positioned on his right hand side, and if his left arm swings forward, the sword moves backward. the sword gets oriented at the right angle relative to his hand tho, so it ends up sort of sticking in his head. Basically everything is inverted somehow with .X models. I never did figure out how to make it act right, I think there is something awry with the matrix returned by the getMatrixOfJoint for .X models.
here is a pic of what i described:

Image
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

found this in CXAnimationPlayer.cpp in function modifySkeleton. Might have something to do with the problem, though niko doesn't specify whether the problem is with his slerp function or with something else, such as core::quaternion::getMatrix()

Code: Select all

// animate it 
switch(currentSet.Animations[i].keyType) 
{ 
    case 0: // rotation 
  {    
  // with this code, rotations are not 100% ok, they are 
   // mirrored. 
   core::quaternion q; 
   q.Slerp(currentSet.Animations[i].Quaternions[idx1], 
    currentSet.Animations[i].Quaternions[idx2], factor); 

     joint.LocalAnimatedMatrix *= q.getMatrix(); 
     joint.WasAnimatedThisFrame = true; 
    } 
    break;
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

math majors?

Post by buhatkj »

heh, anybody here major in math in college??? HELP!!
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Post Reply