Simple question about mesh animations

Viktor

11-11-2009 23:18:43

I'v searched the forum and couldn't find the answer. How can I set the animation of a OGRE3DBody? Is it possible?

mRenderSystem-> createBody(new NxOgre::Capsule(1,4), NxOgre::Vec3(0, 0, 0),"teste.mesh");
When I load this mesh, there is no animation.

The mesh "teste.mesh" have 2 animations called "up" and "sideUp". I'v read about getAnimationState from OGRE entities objects, but I can't acces the mEntity property that should have the getAnimationState method.

I'm not worried about collisions yet

Sorry for my english ;D

Viktor

12-11-2009 00:10:30

I don't think that's the right way, but, it works:

I declare a variable:
Ogre::AnimationState * mAnimationState;
And create a OGRE3DBody and set they animation on createscene:

Body = createBody(new NxOgre::Capsule(1,4), NxOgre::Vec3(0, 0, 0),"teste.mesh");
mAnimationState = Body->getEntity()->getAnimationState("cima");
mAnimationState->setLoop(true);
mAnimationState->setEnabled(true);

Then I add time on the frameStarted from frameListener:
mAnimationState->addTime(evt.timeSinceLastFrame);
But when I try to animate another object using the same AnimationState, only the last one to move. Do I have to create a vector of AnimationStates to have multiple animations?

Thanks

klarax

08-12-2009 14:46:47

Hey man,

I think that is the correct way of doing the animation.

As for the animation stopping when another object is using it, I'm not too sure of as i've not had any experience with it. Soz. but thought at least i've given this post a bump :P

Druha

08-12-2009 18:17:16

You need an AnimationState for each different animation of each your Entity.

Viktor

14-12-2009 23:33:13

Thanks! Good I was on the right way..