Entity Skeleton Animation

Problems building or running the engine, queries about how to use features etc.
Post Reply
ProfessorJ
Gnoblar
Posts: 16
Joined: Tue Aug 14, 2007 6:49 am
Location: Australia

Entity Skeleton Animation

Post by ProfessorJ »

How would I go about adding an AnimationState to an existing entity, which has its own skeleton and animation states already?

I have added the animation to the skeleton and I can see that it increments when I call

Code: Select all

mBodyEnt->getSkeleton()->getNumAnimations()
But I don't know how to make it accessible using the following

Code: Select all

mBodyEnt->getAnimationState(...)

Lax
Orc
Posts: 463
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 27

Re: Entity Skeleton Animation

Post by Lax »

Hi,

you need to know your animation names, which are defined in a .skeleton file. After that just get the animation state from the given animation name.
For example:

Code: Select all

this->animationState = entity->getAnimationState("YourAnimationName");
if (this->animationState)
{
	this->animationState->setEnabled(true);
	this->animationState->setWeight(5.0f);
	this->animationState->setTimePosition(0.0f);
	this->animationState->setLoop(true);
}
...
Later in update loop call:
this->animationState->addTime(dt * speed / this->animationState->getLength());
There are also tutorial on the Ogre site:
http://wiki.ogre3d.org/Intermediate+Tutorial+1

Regards
Lax

ProfessorJ
Gnoblar
Posts: 16
Joined: Tue Aug 14, 2007 6:49 am
Location: Australia

Re: Entity Skeleton Animation

Post by ProfessorJ »

Hi.

Thanks for your reply!

What I mean is, after loading a mesh with a skeleton file (which has one animation), then I programmatically add another animation to the skeleton. The entity still has the original animation only, can check this with mBodyEnt->getAllAnimationStates()->getAnimationStateIterator().

I will follow through the tutorial and see if that helps.

Lax
Orc
Posts: 463
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 27

Re: Entity Skeleton Animation

Post by Lax »

Hi,

try those methods to signal that something changes and will be re-initialized, although I do not know if it will work;

Code: Select all

entity->addSoftwareAnimationRequest(false);
entity->getAllAnimationStates()->_notifyDirty();
entity->_updateAnimation();
Regards
Lax

ProfessorJ
Gnoblar
Posts: 16
Joined: Tue Aug 14, 2007 6:49 am
Location: Australia

Re: Entity Skeleton Animation

Post by ProfessorJ »

That helped.. although the only was I could get it to work was with

Code: Select all

        mBodyEnt->_initialise(true);

just_try
Gnoblar
Posts: 6
Joined: Tue Mar 13, 2018 8:24 pm

Re: Entity Skeleton Animation

Post by just_try »

hello
you said "you need to know your animation names, which are defined in a .skeleton file"
how I know because I open the file and I found some symbols I did not understand it?
give me a name of the software or something help me.and thanks?

User avatar
areay
Bugbear
Posts: 819
Joined: Wed May 05, 2010 4:59 am
Location: Auckland, NZ
x 67

Re: Entity Skeleton Animation

Post by areay »

If you want to see the names of animations in the .skeleton file you can use the 'OgreXMLConverter' or 'OgreMeshTool' tools that come with ogre to convert your .skeleton file into a .skeleton.xml file that you can eyeball.

just_try
Gnoblar
Posts: 6
Joined: Tue Mar 13, 2018 8:24 pm

Re: Entity Skeleton Animation

Post by just_try »

thanks, for your reply :D

just_try
Gnoblar
Posts: 6
Joined: Tue Mar 13, 2018 8:24 pm

Re: Entity Skeleton Animation

Post by just_try »

Hey again ..
I have a problem..i hope you can help me :(
I imported a virtual human in 3ds max (2015) and I applied a movement ('Walk')(. * bip) .. everything works well in 3Ds Max..
but when I export this entity by (Ogre max) to use it in my 'visual studio' code ..
I can not find the name of the animation performed in the (.skelton) file..Why?
?

Post Reply