Page 1 of 1

Problems with .X-file based animation and bones

Posted: Sat Sep 24, 2011 7:38 am
by badday
Hi,

I upgraded my irrlicht version from 1.5 to the latest (1.7.2) one. I now face the problem that my animation system has some trouble, although I´m not yet absolutely sure whether it was caused by the upgrade.

My scenario: I´ve got .X-files which have bones. I set the rotations via bone->setRotation(). But actually nothing happens. I had this behavior once when I worked on the server side as I had to call onAnimate() manually due to the fact that this wasn´t called as with the null-driver, no rendering process is done and therefore this wasn´t called. But this is the client side using OpenGL and I also tried to call onAnimate() manually just to make sure that this didn´t cause the problem.

I call setJointMode(scene::EJUOR_CONTROL) for the animatedSceneNode and animateJoints() as well in order to recalculate the absolute position of the model´s children (well, the bones in this case). As I read in the documentation about this function, this is done on basis of the current frame number. This might be the issue as it says the current frame number to be -1. So I tried to set it manually to 0 via

Code: Select all

node->setJointMode(scene::EJUOR_NONE);
node->setFrameLoop(0,0);
node->setCurrentFrame(0);
node->setLoopMode(false);
However, this didn´t change the current frame number at all, it still remains -1 (which indicates a corrupt frame I guess).


Do you have any clues what might cause the problem? Have there been any changes in the animation stuff from 1.5 to 1.7.2?

If you need more code or information, please just let me know it.



Thanks a lot,


badday

Re: Problems with .X-file based animation and bones

Posted: Tue Sep 27, 2011 2:59 pm
by badday
I would like to add some more information: I do the following things:

Code: Select all

IAnimatedSceneNode *node;
IBoneSceneNode *bone;
 
//...
 
node->setJointMode(scene::EJOUR_CONTROL);
node->animateJoints();
 
bone->setRotation(core::vector3df(0,30,0));
I use driver OpenGL, so onAnimate() should be called during the rendering process I guess. Am I missing anything?

Re: Problems with .X-file based animation and bones

Posted: Tue Sep 27, 2011 4:46 pm
by shadowslair
Still cannot think about what the reason could be. Are you sure all your bones setup and calls are correct? Are you sure you still call animateJoints() as you used to do like half a year ago? http://irrlicht.sourceforge.net/forum/v ... ht=#245653

Check this again just in case you have missed sth: http://irrlicht.sourceforge.net/forum/v ... =1&t=43481

Re: Problems with .X-file based animation and bones

Posted: Tue Sep 27, 2011 4:50 pm
by badday
Are you sure all your bones setup and calls are correct?
Hm... I think so as I should do everything necessary as far as I can see.
Are you sure you still call animateJoints() as you used to do like half a year ago?
Yes, I am :)

Re: Problems with .X-file based animation and bones

Posted: Thu Sep 29, 2011 6:07 pm
by badday
OK, problem is solved. The thing was that I called animateJoints() twice: Once before the rotation and once afterwards. This second time effectively called CSkinnedMesh::recoverJointsFromMesh(core::array<IBoneSceneNode*> &JointChildSceneNodes) which did reset the rotation degrees. So you must draw the thing first (what calles onAnimate()) to call CSkinnedMesh::transferJointsToMesh(const core::array<IBoneSceneNode*> &JointChildSceneNodes) before calling animateJoints() again.

I hope this might help others facing the same problem.

Re: Problems with .X-file based animation and bones

Posted: Thu Oct 06, 2011 12:16 am
by Maxx
badday:

Thanks for sharing; very useful info.