Problems with .X-file based animation and 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
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Problems with .X-file based animation and bones

Post 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
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

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

Post 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?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

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

Post 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
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

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

Post 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 :)
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

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

Post 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.
Maxx
Posts: 1
Joined: Fri Jun 10, 2011 1:21 pm

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

Post by Maxx »

badday:

Thanks for sharing; very useful info.
Post Reply