Animating child nodes

Problems building or running the engine, queries about how to use features etc.
Post Reply
svarog611
Gnoblar
Posts: 2
Joined: Thu Aug 20, 2015 3:18 pm

Animating child nodes

Post by svarog611 »

Hi.

I've created model in Blender and successfully exported it to ogre format. It shows rather well, but when I'm trying to turn on animation with this code

Code: Select all

void TutorialApplication::createScene(void)
{
...
  Ogre::Entity *ent = mSceneMgr->createEntity("Cylinder.001.mesh");
  mCharAnimState = ent->getAnimationState("turn");
  mCharAnimState->setEnabled(true);
  mCharAnimState->setLoop(true);
}
it looks like only parent node is animated. I know, that in openscenegraph you have to manually turn on all child animation, should I do something similiar there? How can I achieve this?

https://yadi.sk/d/nk1PqB75iaFac link with model archive
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Animating child nodes

Post by Kojack »

Are you adding time to the animation state at regular intervals?
Turning on animation doesn't actually make it animate automatically, you need to manually tell it about time.
mCharAnimState->addTime(deltatime);
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Animating child nodes

Post by Kojack »

Ok, I just opened up the mesh in OgreMeshy (great tool for testing exports).
The archive didn't include a binary skeleton file, just the xml. I used the OgreXmlConvertor to make the binary.
I see what you mean, it looks like just the node is moving. The bones themselves are really moving (in OgreMeshy you can enable skeleton view), but all the vertices of the mesh act like they are attached to a single bone.
Looking in the mesh data, all the vertices have bone assignments that look correct. My only guess is that the mesh is using shared geometry. I know non shared geometry works, that's how models like the ninja were exported.
(Shared geometry says whether sub meshes have their own vertex data or share a common vertex buffer. Your model has only a single submesh, so non shared shouldn't hurt)
svarog611
Gnoblar
Posts: 2
Joined: Thu Aug 20, 2015 3:18 pm

Re: Animating child nodes

Post by svarog611 »

Kojack wrote: (Shared geometry says whether sub meshes have their own vertex data or share a common vertex buffer. Your model has only a single submesh, so non shared shouldn't hurt)
Hi, Kojack.

First of all, thank you for reply and for OgreMeshy, it's really helpful.
But how I should solve this problem? Redraw the source model(btw, it was made in Blender), or do smth else?
At last, could you, please, point me to the resource, where I can find necessary information on dealing with (non)shared geometry, and how OGRE can work with it?

P.S. and yes, I've added mCharAnimState->addTime(deltatime); in frameStarted method(because BaseApplication is child of FrameListener).
Post Reply